[12885] in Perl-Users-Digest
Perl-Users Digest, Issue: 295 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 29 11:07:18 1999
Date: Thu, 29 Jul 1999 08:05:17 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 29 Jul 1999 Volume: 9 Number: 295
Today's topics:
Re: Any Suggestions (Anno Siegel)
Re: Any Suggestions? (Abigail)
Re: ASCII to ANSI conversion -- HELP <nospam.newton@gmx.net>
DBM question (Anno Siegel)
Re: ebcdic packed numbers <nospam.newton@gmx.net>
Re: ebcdic packed numbers <uri@sysarch.com>
File upload problem Newbie!! <Paul.Foran@analog.com>
Re: File upload problem Newbie!! <swiftkid@bigfoot.com>
File upload with cgi-bin and port to MSQL Please help!! <Paul.Foran@analog.com>
Re: File upload with cgi-bin and port to MSQL Please he <swiftkid@bigfoot.com>
Re: Forbidden (Abigail)
Re: form, binary attachments <again> <swiftkid@bigfoot.com>
Re: GET, but starting at byte 5000, and just get 2000 b (Abigail)
Re: Getting Height and Width of GIF/JPEG in PERL? (Abigail)
Re: Getting Height and Width of GIF/JPEG in PERL? <uri@sysarch.com>
Re: Hashes of Hashes <simon.brown@kns.ch>
Re: Hashes of Hashes (Jaime)
Help! - Monitoring script <James_Nedham@ml.com>
Re: Help! - Monitoring script <swiftkid@bigfoot.com>
Re: Help! - Monitoring script <swiftkid@bigfoot.com>
Re: Help!! ---Database access in perl <sariq@texas.net>
Re: how automatic assign a name to a hash (Anno Siegel)
How to count clicks to HTML link. <Andres.Magi@microlink.ee>
Re: How to count clicks to HTML link. <swiftkid@bigfoot.com>
How to trim a String <amynuk@aol.com>
Re: How to trim a String <swiftkid@bigfoot.com>
Information on Search Engines <rabinv@hotmail.com>
Login script, help please <wgemini-nospam@hotmail.com>
Re: Looking for Free PERL based discussion forum <keithmur@mindspring.com>
Re: module for Oracle? <sariq@texas.net>
MS-Access SQL to SQL92 converter ?? monsri@my-deja.com
my conflict with sort() (Ryan Ngi)
Re: my conflict with sort() (Michel Dalle)
Re: my conflict with sort() <swiftkid@bigfoot.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 29 Jul 1999 13:23:41 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Any Suggestions
Message-Id: <7npkkt$1a0$1@lublin.zrz.tu-berlin.de>
Steve Wagner <steven_crazyman@worldnet.att.net> wrote in comp.lang.perl.misc:
>Sorry for the double post but the last one was the wrong script.
This script differs from the one you posted before in only minor details
in what it prints. Do you really think you are going to get significantly
different replies? Or can we expect a third version soon?
Anno
------------------------------
Date: 29 Jul 1999 08:40:05 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Any Suggestions?
Message-Id: <slrn7q0mcn.f8f.abigail@alexandra.delanet.com>
revjack (revjack@radix.net) wrote on MMCLVIII September MCMXCIII in
<URL:news:7npg6a$8rp$2@news1.Radix.Net>:
##
## $browser = $ENV{'HTTP_USER_AGENT'};
##
## if ($browser =~ /Mozilla/) {
## #
## # Netscape
## #
## } else {
## #
## # Non Netscape
## #
## }
##
Naive, and wrong.
Just because this is being misused by clueless document authors, the
user agent HTTP header is now next to worthless, due to user agents
spoofing other user agents.
Besides, if one can rub two braincells together, one doesn't have to
degrade itself and write user agent specific documents.
Followups set.
Abigail
--
perl -e 'for (s??4a75737420616e6f74686572205065726c204861636b65720as?;??;??)
{s?(..)s\??qq \?print chr 0x$1 and q ss\??excess}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 29 Jul 1999 16:39:17 +0200
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.net>
Subject: Re: ASCII to ANSI conversion -- HELP
Message-Id: <37A06795.48295DEA@gmx.net>
Alan J. Flavell wrote:
>
> On Wed, 28 Jul 1999 jeff.fritsche@persoft.com wrote:
>
> > I need to create a script that converts ANSI characters to ASCII
> > characters.
>
> So what is it actually that you hope to achieve with this
> "conversion"?
Chances are he means, roughly, "ISO-Latin-1 (or Windows-1252) --> IBM
Codepage 437 (or 850)".
Cheers,
Philip
------------------------------
Date: 29 Jul 1999 15:00:48 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: DBM question
Message-Id: <7npqb0$1f3$1@lublin.zrz.tu-berlin.de>
Zeng <zeng@haas.Berkeley.EDU> wrote in comp.lang.perl.misc:
>> from perlfunc regarding function each:
>>
>> "... If you add
>> or delete elements of a hash while you're iterating
>> over it, you may get entries skipped or duplicated,
>> so don't."
>
>That is the problem. Thank you. Actually, this very example probably
>illustrates the difference between Perl and other languages. Most
>languages' compiler would prevent me from writing a 'delete' statement in
>that loop using an 'each' function, or at least give me a warning. But
What? Show me one compiler that does that sort of thing and I'll show
you one guy who ain't gonna study Perl no more.
Anno
------------------------------
Date: Thu, 29 Jul 1999 16:32:50 +0200
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.net>
Subject: Re: ebcdic packed numbers
Message-Id: <37A06612.864711BA@gmx.net>
Uri Guttman wrote:
>
> only the ibm 360 (and descendents), the vax and a few others did this
> in hardware. no risc machines could do it directly since by
> definition, decimal instructions are cisc.
As far as I know, x86 processors can do this in a two-step process using
DAA / DAS (decimal adjust after addition/subtraction) or AAA/AAS/AAD/AAM
(ASCII adjust after...). I think DAA and DAS were in 8080 and Z80 chips,
as well. So you could do addition and subtraction with packed numbers,
at least -- by using the normal ADD/SUB opcode and then correcting with
DAA/DAS.
Cheers,
Philip
------------------------------
Date: 29 Jul 1999 10:33:17 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: ebcdic packed numbers
Message-Id: <x7wvvjplua.fsf@home.sysarch.com>
>>>>> "AJF" == Alan J Flavell <flavell@mail.cern.ch> writes:
AJF> On 29 Jul 1999, Uri Guttman wrote:
>> my pl/1 runtime supported up to 15 decimal digits plus sign nibble.
AJF> That reflects the inherent IBM/360 architecture, where the length of
AJF> packed-decimal operands was specified by a nibble in the instruction
AJF> format.
>> >> you can't
>> >> operate on bcd in perl directly
AJF> To add two BCD data, in effect you have to add the two together
AJF> (as if they were binary data), plus 6666... to get the carry-over
AJF> from digit to digit, and then take the 6666... off again without
AJF> producing a borrow. Surely this can be done with some clever
AJF> combination of xor and masking and stuff? I've done it in
AJF> hardware, years ago ;-)
it is called excess 3 notation and i did use that. but you still have to
align the decimal points by shifting one or the other. once aligned you
can add 3's to each bcd digit using 32 bit integer math and then you
can detect carries and compensate. i don't recall the exact algorithm
now but it is well known. i was taught it by our code generator guru.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Thu, 29 Jul 1999 14:39:36 +0100
From: Paul Foran <Paul.Foran@analog.com>
Subject: File upload problem Newbie!!
Message-Id: <37A05998.2C01C06D@analog.com>
Hi all,
Can somebody get me started on this one as I am new to Perl. I need to
be able to upload a Data file to a server via a HTML form. The datafile
is delimited table from MS Access. I need towrite to srcipts that will
accept the file being uploaded and to also get MSQL to read this table
into an exsisting table within MSQL.
Any solutions , thanks alot
------------------------------
Date: Thu, 29 Jul 1999 19:03:35 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: File upload problem Newbie!!
Message-Id: <7nqqad$obf1@news.cyber.net.pk>
: Hi all,
: Can somebody get me started on this one as I am new to Perl. I need to
: be able to upload a Data file to a server via a HTML form. The datafile
: is delimited table from MS Access. I need towrite to srcipts that will
: accept the file being uploaded and to also get MSQL to read this table
: into an exsisting table within MSQL.
perldoc CGI
perldoc DBI
Get mSQL drivers for DBI from CPAN.
Reading Access file in Unix? ... not sure :P
------------------------------
Date: Thu, 29 Jul 1999 14:29:11 +0100
From: Paul Foran <Paul.Foran@analog.com>
Subject: File upload with cgi-bin and port to MSQL Please help!!
Message-Id: <37A05727.ABCBE189@analog.com>
I need to be able to upload a delimited data table to me ISP's unix
box. How can I get user to browse to the file to upload and execute a
perl sctip to accept this file. How Do I pass it onto MSQL table?
------------------------------
Date: Thu, 29 Jul 1999 19:20:43 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: File upload with cgi-bin and port to MSQL Please help!!
Message-Id: <7nqraf$oo04@news.cyber.net.pk>
: I need to be able to upload a delimited data table to me ISP's unix
: box. How can I get user to browse to the file to upload and execute a
: perl sctip to accept this file. How Do I pass it onto MSQL table?
:
1. Use CGI and DBI
2. Get file from CGI (perdoc CGI for example)
3. Connect to mSQL server (using DBI and mSQL dbd driver)
4. Use quote() method to quote the binary file
5. send
INSERT INTO yourtablename VALUES ( $picture ),
(where $picture is quote()ed binary file...)
through dbprepare()
5. call execute()
Note: Do error checking yourself :)
DBI manual has all the info about the SQL part, and CGI
manual page has all the info to retreive a file through
client browser .... of course with examples! :P
------------------------------
Date: 29 Jul 1999 08:43:25 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Forbidden
Message-Id: <slrn7q0miv.f8f.abigail@alexandra.delanet.com>
Maria Zevenhoven (maria.zevenhoven@kolumbus.fi) wrote on MMCLVIII
September MCMXCIII in <URL:news:7npbdj$c5$1@news.kolumbus.fi>:
{} You don't have permission to access /kalenteri.cgi on this server.
{}
{} It's been long since I made my last script, and now I started again, and got
{} this message. I put chmod 775 script.cgi, but still... have I forgot
{} something here?
Yes. You forgot two things. 1) you didn't ask your system administrator.
And 2) you forgot that this isn't the appropriate group to discuss that.
Abigail
--
sub A::TIESCALAR{bless\my$x=>A};package B;@q=qw/Hacker Another
Perl Just/;use overload'""'=>sub{pop @q};sub A::FETCH{bless\my
$y=>B}; tie my $shoe => 'A';print "$shoe $shoe $shoe $shoe\n";
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 29 Jul 1999 19:17:48 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: form, binary attachments <again>
Message-Id: <7nqr55$oo03@news.cyber.net.pk>
: Searching the web for the script I need I ended up here.
: I must admit I don't know a damn thing about Perl.
Too bad!
: I've seen some scripts and decided not to get into this because you just
: can't know it all.
Right....
: Here's my problem:
: Like many others I am looking for a script with which I can let my website
: visitors attach a binary file from their PC to the form displayed and mail
: it to me.
People are always _wanting_ and not giving anything, what did Larry get?
What did Mr. Linus get for making Linux and giving for free? ... They are
great heroes though :)
: Now, please don't send me replies about MIME::Lite and CPAN because like I
: said I don't know anything about perl.
If you don't know Perl, then learn Perl. I assure you won't waste your
time! :)
: Does anybody have a script like this to share ?
If you knew Perl, you could make it in 2 minutes!
: Or maybe an example ?
Oh boy, you asked for it :)
Go to CPAN and download MIME::Lite module.. you don't need to install it
at this point :)
Just looking to Lite.pm and see the documentation either in the
beginning or the end and see an example there.
Or search @ perl.com
------------------------------
Date: 29 Jul 1999 08:47:38 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: GET, but starting at byte 5000, and just get 2000 byte
Message-Id: <slrn7q0mqh.f8f.abigail@alexandra.delanet.com>
Kin Lum (kin@0011.com) wrote on MMCLVIII September MCMXCIII in
<URL:news:37A03A0B.F2BED320@0011.com>:
;; a question for LWP: it seems that you can send a "GET"
;; request for a file, but say, starting at byte 5000
;; and then you want just 2000 bytes.
;;
;; Is that possible?
Yes. See the HTTP RFC.
;; The routines I saw are all getting the complete file.
;;
;; And if it is possible, can most Web server support it?
;; I think some cannot?
That's beyond the topic of this group.
Abigail
--
tie $" => A; $, = " "; $\ = "\n"; @a = ("") x 2; print map {"@a"} 1 .. 4;
sub A::TIESCALAR {bless \my $A => A} # Yet Another silly JAPH by Abigail
sub A::FETCH {@q = qw /Just Another Perl Hacker/ unless @q; shift @q}
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 29 Jul 1999 08:35:04 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Getting Height and Width of GIF/JPEG in PERL?
Message-Id: <slrn7q0m39.f8f.abigail@alexandra.delanet.com>
Abigail (abigail@delanet.com) wrote on MMCLVIII September MCMXCIII in
<URL:news:slrn7pvtec.eo5.abigail@alexandra.delanet.com>:
##
## Bill Gates has tried invading or ruining my environment. Billware runs
## on other peoples computers. Not mine. Not *my* problem. Bill leaves me
## alone.
That should be: 'Bill Gates has NOT tried....'
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 29 Jul 1999 10:39:19 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Getting Height and Width of GIF/JPEG in PERL?
Message-Id: <x7u2qnplk8.fsf@home.sysarch.com>
>>>>> "A" == Abigail <abigail@delanet.com> writes:
A> Bill Gates has tried invading or ruining my environment. Billware runs
A> on other peoples computers. Not mine. Not *my* problem. Bill leaves me
A> alone.
<the corrected NOT tried is assumed>
but he has infected your world. think about all those pob newbies you
flame so lovingly. and all the bad perl code out there created by
them. and all the bad html created by redmondware. unfortunately the
redmond disease has infected all computer systems in some way (some much
more than others).
A> The web however, was supposed to be a common source of information.
A> For all of us. And *that*'s be ruined. And that's something which hurts
A> me. And for which I hold Netscape partially responsible for.
agreed. but the evil empire is much bigger and worse.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Thu, 29 Jul 1999 15:13:48 +0200
From: "Simon Brown" <simon.brown@kns.ch>
Subject: Re: Hashes of Hashes
Message-Id: <7npk2g$let$1@fu-berlin.de>
Mark,
Thanks a million.
Simon
---
Simon Brown, Casa Bergenia, 7031 Laax, Switzerland
Mark <Mark@Mark.Com> wrote in message news:37A04F3E.BA3811DC@Mark.Com...
>
>
> Simon Brown wrote:
>
> > Hi All,
> >
> > Example:
> >
> > %hash = ();
> > $hash{"Simon"}{"Age"} = 42;
> > $hash{"Simon"}{"Weight"} = 80;
> > $hash{"Simon"}{"Rich"} = "No";
> >
> > I want to know how I can get a list of the subkeys Age, Weight and Rich
so
> > that I can dump the hash. Obviously I can start with something like:
> >
> > foreach $person (keys %hash)
> > {
> > foreach $attribute ( keys %{$hash{$person}})
>
> {
> print "$person - $attribute -
$hash{$person}{$attribute}","\n";
> }
>
> >
> > }
> >
> > I've looked everywhere. I gues it's simple once I know it. A reply to
> > simon.brown@kns.ch as well as here would result in undying gratitude.
> >
> > Simon
> >
> > ---
> > Simon Brown, Casa Bergenia, 7031 Laax, Switzerland
>
------------------------------
Date: Thu, 29 Jul 1999 16:58:10 +0300
From: lsprilus@weizmann.weizmann.ac.il (Jaime)
Subject: Re: Hashes of Hashes
Message-Id: <lsprilus-2907991658100001@meg.weizmann.ac.il>
I>%hash = ();
>$hash{"Simon"}{"Age"} = 42;
>$hash{"Simon"}{"Weight"} = 80;
>$hash{"Simon"}{"Rich"} = "No";
>I want to know how I can get a list of the subkeys Age, Weight and Rich so
>that I can dump the hash. Obviously I can start with something like:
adapted from perldoc perldsc
foreach $person ( sort keys %hash) {
print "$person: { ";
for $subkeys( sort keys %{ $hash{$person} } ) {
print "$subkeys=$hash{$person}{$subkeys} ";
}
print "}\n";
}
will produce:
Simon: { Age=42 Rich=No Weight=80 }
--
Jaime Prilusky
lsprilus@weizmann.weizmann.ac.il
------------------------------
Date: Thu, 29 Jul 1999 15:05:05 +0100
From: "James Nedham" <James_Nedham@ml.com>
Subject: Help! - Monitoring script
Message-Id: <7npn26$hie$1@news.ml.com>
Does anyone know any examples of Perl scripts that check log files for
certain words then notifies me when those words are written to the log
files?
Also does anyone know how to write a script in Perl to check if a certain
process is running & if it isn't then it would notify me?
Thank in advance
------------------------------
Date: Thu, 29 Jul 1999 19:43:31 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Help! - Monitoring script
Message-Id: <7nqsl9$obf4@news.cyber.net.pk>
: Does anyone know any examples of Perl scripts that check log files for
: certain words then notifies me when those words are written to the log
: files?
A recursive function perhaps? with a sleep in it....
&mysub;
sub mysub
{
# open file, read, find word, set $flag = 1 if not found
sleep 2 , &mysub if $flag;
}
:
: Also does anyone know how to write a script in Perl to check if a certain
: process is running & if it isn't then it would notify me?
$data = `ps ax`;
now run a regexp.
:
: Thank in advance
Thanx received, processed, result:
Syntax error at last line in this message near 'Thanx': (did you mean
Thanks?)
:P
------------------------------
Date: Thu, 29 Jul 1999 19:46:26 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Help! - Monitoring script
Message-Id: <7nqsqr$obf6@news.cyber.net.pk>
: A recursive function perhaps? with a sleep in it....
:
: &mysub;
:
: sub mysub
: {
: # open file, read, find word, set $flag = 1 if not found
:
: sleep 2 , &mysub if $flag;
: }
If it doesn't find it for sometime, you can exit and set
your script for cron.... or perhaps set script to run
after each minute, unless the condition is true :)
(and then perl script removes itself from cron list)
------------------------------
Date: Thu, 29 Jul 1999 09:13:04 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Help!! ---Database access in perl
Message-Id: <37A06170.4508F2A9@texas.net>
Martien Verbruggen wrote:
> Sprite is free.
Then how do they pay for those Kobe Bryant commercials?
- Tom
------------------------------
Date: 29 Jul 1999 15:04:07 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: how automatic assign a name to a hash
Message-Id: <7npqh7$1gc$1@lublin.zrz.tu-berlin.de>
Bob Walton <bwalton@rochester.rr.com> wrote in comp.lang.perl.misc:
>> ...
>> I am looking for a way to automate a nameassignment to a hash.
>> The problem is this:
>>
>> I have an allround-cgi-script that generates different amounts of
>> key-value pairs.
>> I would put some of them in different hashes, but i never know how
>> many
>> hashes i will need. So I need a way to name the hashes in an automated
>> way.
>> ...
>
>Use a hash of hashes.
[snip good advice]
And don't post mime and html. You did *both* in a single posting.
Anno
------------------------------
Date: Thu, 29 Jul 1999 17:41:00 +0300
From: andres <Andres.Magi@microlink.ee>
Subject: How to count clicks to HTML link.
Message-Id: <37A067FC.D761A847@microlink.ee>
How to solve problem to count clicks on certain links(pointing out of
my site) on my website?
Andres
------------------------------
Date: Thu, 29 Jul 1999 19:45:35 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: How to count clicks to HTML link.
Message-Id: <7nqsqm$obf5@news.cyber.net.pk>
: How to solve problem to count clicks on certain links(pointing out of
: my site) on my website?
1. Learn Perl.
2. Make your links like this:
<a href="blah.cgi?/mydir/mypage.html">
Use any nice database and increase hits .... and then redirect
to the page... easy eh?
------------------------------
Date: 29 Jul 1999 10:22:50 -0500
From: "Amyn " <amynuk@aol.com>
Subject: How to trim a String
Message-Id: <37a063ba@discussions>
I am a beginner in PERL and I wanted to know how to trim a String
I wanted to get rid of all spaces in a string
--Posted from EarthWeb Discussions. http://discussions.earthweb.com
------------------------------
Date: Thu, 29 Jul 1999 19:39:32 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: How to trim a String
Message-Id: <7nqsdv$obf3@news.cyber.net.pk>
: I am a beginner in PERL and I wanted to know how to trim a String
: I wanted to get rid of all spaces in a string
I wonder why there aren't precompiled functions like:
rtrim(), ltrim, trim()....
Anyway.
$str = " my string ";
$str = trim ( $str );
sub trim
{
( local $_ = shift ) =~ s/\s+|\s+$//gs;
$_
}
--
Faisal Nasim (the Whiz Kid)
Web: http://wss.hypermart.net/
FAX: (815) 846-2877
------------------------------
Date: Thu, 29 Jul 1999 09:54:10 -0400
From: Rab <rabinv@hotmail.com>
Subject: Information on Search Engines
Message-Id: <37A05D02.C2AF1DF8@hotmail.com>
Hi,
I was wondering if any one has any good links to resources that show how
search engines work (methodology/techniques), and how to set up a search
engine on a webserver (unix or NT). Even a good script recommendation
would be helpful.
Thank you in advace,
Rab
------------------------------
Date: Thu, 29 Jul 1999 09:29:43 -0400
From: "W Gemini" <wgemini-nospam@hotmail.com>
Subject: Login script, help please
Message-Id: <7npkub$q31$1@newsflash.concordia.ca>
I'm new to perl and I'm writing a login script to control accesses to a set
of html pages. I was told that I can do this by writing a session file to
the server side once the user log in and delete the file once time expires.
Could somebody give me a example on how to do that or tell me where I can
find one on the web? Thanks.
------------------------------
Date: Thu, 29 Jul 1999 09:21:35 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: Looking for Free PERL based discussion forum
Message-Id: <37A0636F.4FAAB55@mindspring.com>
Joe Novielli wrote:
>
> Hi all,
>
> Can anyone recommend a good perl (CGI) based discussion forum scripts.
> FREE of course.
>
> Something like O'reilly's WebBoard (see http://webtalk.us.dell.com/~1),
> (not Matt Wright's WWWboard) .
>
comp.lang.perl.misc was not really the place to look for this, probably,
but...
Look for something called e_board. Totally perl and seems to work.
Hope that helps.
------------------------------
Date: Thu, 29 Jul 1999 09:43:45 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: module for Oracle?
Message-Id: <37A068A1.988FF224@texas.net>
metalogician wrote:
>
> Oraperl is a lot of fun.
And when is the last time you updated it?
- Tom
------------------------------
Date: Thu, 29 Jul 1999 14:37:51 GMT
From: monsri@my-deja.com
Subject: MS-Access SQL to SQL92 converter ??
Message-Id: <7npovu$m9h$1@nnrp1.deja.com>
Hello here,
I'd just like to know whether anybody ever heard about -or wrote
himself ?- some Perl that would convert the peculiar Microsoft
Access SQL generated by the Access query designer into some more
standard SQL code...
If you have any help or advice, thanks for mailing me !!
Regards,
Spendius
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 29 Jul 1999 12:48:44 GMT
From: ryanngi@hotmail.com (Ryan Ngi)
Subject: my conflict with sort()
Message-Id: <37a04c93.3956206@news.inet.co.th>
1 : why can't i do this:
test();
sub test{
my $a;
my $b;
my %HASH=("a"=>5,"c"=>7,"b"=>6,"d"=>8,"z"=>10,"x"=>9);
my @SBV = sort { $HASH{$a} <=> $HASH{$b} } keys %HASH;
print @SBV;
}
................. it's error
and
2 : why this not work:
test();
sub test{
my %HASH=("a"=>5,"c"=>7,"b"=>6,"d"=>8,"z"=>10,"x"=>9);
my @SBV = sort { $HASH{my $a} <=> $HASH{my $b} } keys %HASH;
print @SBV;
}
....................... this not error but the result not sorted;
!? confusing so much
------------------------------
Date: Thu, 29 Jul 1999 13:39:36 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: my conflict with sort()
Message-Id: <7nplmv$nhd$1@news.mch.sbs.de>
In article <37a04c93.3956206@news.inet.co.th>, ryanngi@hotmail.com (Ryan Ngi) wrote:
>1 : why can't i do this:
>
>test();
>
>sub test{
> my $a;
> my $b;
> my %HASH=("a"=>5,"c"=>7,"b"=>6,"d"=>8,"z"=>10,"x"=>9);
>
> my @SBV = sort { $HASH{$a} <=> $HASH{$b} } keys %HASH;
>
> print @SBV;
>}
>
>.................. it's error
Have you looked at the error ? For me, it says :
Can't use "my $a" in sort comparison at mysort.txt line 9.
Add 'use diagnostics;' in your script and you'll get :
Can't use "my $a" in sort comparison at mysort.txt line 10 (#1)
(F) The global variables $a and $b are reserved for sort comparisons.
You mentioned $a or $b in the same line as the <=> or cmp operator,
and the variable had earlier been declared as a lexical variable.
Either qualify the sort variable with the package name, or rename the
lexical variable.
Uncaught exception from user code:
Can't use "my $a" in sort comparison at mysort.txt line 10.
>
>and
>
>2 : why this not work:
>
>test();
>
>sub test{
> my %HASH=("a"=>5,"c"=>7,"b"=>6,"d"=>8,"z"=>10,"x"=>9);
>
> my @SBV = sort { $HASH{my $a} <=> $HASH{my $b} } keys %HASH;
>
> print @SBV;
>}
>
>........................ this not error but the result not sorted;
Add -w to your #!/path/to/perl line, and you'll get a warning :
Use of uninitialized value at mysort.txt line 9.
...
>!? confusing so much
In short (and as described in perlfunc for the function 'sort'), do NOT
declare $a and $b. And if you're using 'strict', see how to use them in
different packages...
When in doubt, look it up :-)
Michel.
------------------------------
Date: Thu, 29 Jul 1999 19:11:24 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: my conflict with sort()
Message-Id: <7nqqp0$oo02@news.cyber.net.pk>
: my @SBV = sort { $HASH{my $a} <=> $HASH{my $b} } keys %HASH;
When you my() them, they loose their values :)
my @SBV = sort { $HASH{$a} <=> $HASH{$b} } keys %HASH;
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 295
*************************************