How can I upgrade Perl?

2006-03-10 Thread Richard Fernandez
Is there a simple way to upgrade the current version of Perl that's running on a unix box? Is it possible to use CPAN for this (I didn't see anytning about this in the man page). Thanks in advance. Richard - Yahoo! Mail Bring photos to

Re: Grep frustration

2006-03-10 Thread John W. Krahn
Jay Savage wrote: > > I've actually found it depends partly on architecture, too; the regex > engine seems better optimized on some platforms than others. I was > quite surprised once when benchmarking a script on a fairly modern OS > X/PPC machine (750MHz CRT iMac) and an ancient Linux box (166MH

Re: Help me out....

2006-03-10 Thread Tom Phoenix
On 3/9/06, Rakesh Mishra <[EMAIL PROTECTED]> wrote: > well I have to prepare for the tech. interview for the post of Perl > Programmer (first time). When they ask you to write a Perl program, start with this: #!/usr/bin/perl use strict; use warnings; That much will probably count f

Re: Grep frustration

2006-03-10 Thread Jay Savage
On 3/9/06, Tom Phoenix <[EMAIL PROTECTED]> wrote: > On 3/9/06, Brian McKee <[EMAIL PROTECTED]> wrote: > > > What is a pattern match good for if it isn't for finding a substring > > in a string? > > That's a fair question. A pattern match finds a match for a pattern, > not a substring. Patterns can

Re: Grep frustration

2006-03-10 Thread John W. Krahn
Tom Phoenix wrote: > On 3/10/06, Jay Savage <[EMAIL PROTECTED]> wrote: > >>Are the two shorter matches more efficient than a single one >>for some reason? > > Probably; smaller, simpler patterns give the regular expression engine > more room for optimizations. The order of the two patterns may al

Re: Grep frustration

2006-03-10 Thread Tom Phoenix
On 3/10/06, Jay Savage <[EMAIL PROTECTED]> wrote: > Are the two shorter matches more efficient than a single one > for some reason? Probably; smaller, simpler patterns give the regular expression engine more room for optimizations. The order of the two patterns may also make a difference, but any

Re: Grep frustration

2006-03-10 Thread Jay Savage
On 3/9/06, John W. Krahn <[EMAIL PROTECTED]> wrote: > Brian Poellnitz wrote: > > > > The sample data below is read into a list, @dir_files. What I'd like > > to do is grep() the list so that I'm left with only files that end in > > ".wav" and contain certain string. The "certain string" is where

Re: Need to get number of charictors to the first blank (white space) space

2006-03-10 Thread John W. Krahn
Gallagher, Tim (NE) wrote: > Lets say that I have a variable; > > My $test = "asdfjaslfkjasdf lksaflksajfalksjf fsalkjsaflkjsafd fajd > alsjfk"; > > I want a way to count the number of characters to the first space. Is > there an easy function to do this??? $ perl -le' my $test = q[asdfjaslfkja

Re: Does this script have the efficiency problems?

2006-03-10 Thread Chas Owens
On 3/9/06, Practical Perl <[EMAIL PROTECTED]> wrote: snip > my $dir="/home/datas/loginIP";# here stored about 140 files,which are > totally 1.7G. snip > next if /^192\.168\./; > next unless /^(\d+\.\d+\.\d+\.)(\d+)/; > $low{$1}{$2}=1 if $2 < 128;

Re: Need to get number of charictors to the first blank (white space) space

2006-03-10 Thread Tom Phoenix
On 3/10/06, Gallagher, Tim (NE) <[EMAIL PROTECTED]> wrote: > My $test = "asdfjaslfkjasdf lksaflksajfalksjf fsalkjsaflkjsafd fajd > alsjfk"; > I want a way to count the number of characters to the first space. Is > there an easy function to do this??? The easy function to find the length of a st

Re: i say literal; perl says metacharacter

2006-03-10 Thread Chas Owens
On 3/10/06, tom arnall <[EMAIL PROTECTED]> wrote: > the following script is intended to uppercase every character preceded by [?.] > and one or two spaces: > > ($f,$g)=/([?.] {1,2})([a-z])/s; > $h = uc $g; > s/$f$g/$f$h/s; > > in the third line however perl interprets the [.?] in $f as a metacharac

RE: Need to get number of charictors to the first blank (white space) space

2006-03-10 Thread Timothy Johnson
Have you seen the length() function? perldoc -f length If you use a pattern match to grab all of the characters up to the first space, you can check the length of $1. -Original Message- From: Gallagher, Tim (NE) [mailto:[EMAIL PROTECTED] Sent: Friday, March 10, 2006 12:16 PM To: Perl

Need to get number of charictors to the first blank (white space) space

2006-03-10 Thread Gallagher, Tim \(NE\)
Lets say that I have a variable; My $test = "asdfjaslfkjasdf lksaflksajfalksjf fsalkjsaflkjsafd fajd alsjfk"; I want a way to count the number of characters to the first space. Is there an easy function to do this??? Thanks Tim

Re: i say literal; perl says metacharacter

2006-03-10 Thread John W. Krahn
tom arnall wrote: > the following script is intended to uppercase every character preceded by > [?.] > and one or two spaces: > > ($f,$g)=/([?.] {1,2})([a-z])/s; > $h = uc $g; > s/$f$g/$f$h/s; > > in the third line however perl interprets the [.?] in $f as a metacharacter. > is there any way

Re: i say literal; perl says metacharacter

2006-03-10 Thread Shawn Corey
Tom Phoenix wrote: On 3/10/06, tom arnall <[EMAIL PROTECTED]> wrote: is there any way to get perl to interpret the contents of $f as a literal? I think you're looking for the quotemeta() function. Hope this helps! --Tom Phoenix Stonehenge Perl Training You can also use the \Q meta-charact

Re: i say literal; perl says metacharacter

2006-03-10 Thread Tom Phoenix
On 3/10/06, tom arnall <[EMAIL PROTECTED]> wrote: > is there any way to get perl to interpret the contents of $f as a literal? I think you're looking for the quotemeta() function. Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

i say literal; perl says metacharacter

2006-03-10 Thread tom arnall
the following script is intended to uppercase every character preceded by [?.] and one or two spaces: ($f,$g)=/([?.] {1,2})([a-z])/s; $h = uc $g; s/$f$g/$f$h/s; in the third line however perl interprets the [.?] in $f as a metacharacter. is there any way to get perl to interpret the contents o

Re: multiple system commands

2006-03-10 Thread Jay Savage
On 3/10/06, Saurabh Singhvi <[EMAIL PROTECTED]> wrote: > Hi > > thanks for the reply. I can't use the if condition twice > as the code after the outside system command is supposed > to get executed only after completion of former. > > about the installation, yes i am using the tarball to install it

RE: Parallel Port Error

2006-03-10 Thread Timothy Johnson
Did you download and install Device::PareallelPort::drv::linux from CPAN? -Original Message- From: LinuxMurah.com [mailto:[EMAIL PROTECTED] Sent: Friday, March 10, 2006 3:41 AM To: beginners@perl.org Subject: Parallel Port Error Dear Friends, I have Perl module for Parallel Port ins

Re: multiple system commands

2006-03-10 Thread Jay Savage
On 3/10/06, Saurabh Singhvi <[EMAIL PROTECTED]> wrote: > i got the following error while trying to install spork > > Checking if your kit is complete... > Looks good > Warning: prerequisite version 0 not found. > Could not eval ' > package ExtUtils::MakeMaker::_version; > no

Re: XML Parsing error - regex problem?

2006-03-10 Thread Tom Phoenix
On 3/10/06, Graeme McLaren <[EMAIL PROTECTED]> wrote: > I've checked my XML file and it contains: > St. Patrick<92>s R.C. P.S. > > This is because St. Patrick's contains an apostrophe. I'm guessing that where I see four characters "<92>", the actual file has a single character. Some tools render

Re: multiple system commands

2006-03-10 Thread Saurabh Singhvi
Hi thanks for the reply. I can't use the if condition twice as the code after the outside system command is supposed to get executed only after completion of former. about the installation, yes i am using the tarball to install it. system flags -O3, gentoo system. thanks Saurabh On 3/10/06, Ja

Re: multiple system commands

2006-03-10 Thread Jay Savage
On 3/10/06, Saurabh Singhvi <[EMAIL PROTECTED]> wrote: > also i tried using this > > my $child = fork (); > > unless ($child) { > sleep 5; > print "child\n"; > } > print 2; > > block of code, but i had a problem. Instead of the print statements, > i had 2 system calls on

Re: multiple system commands

2006-03-10 Thread Saurabh Singhvi
also i tried using this my $child = fork (); unless ($child) { sleep 5; print "child\n"; } print 2; block of code, but i had a problem. Instead of the print statements, i had 2 system calls one inside the block and one outside. Now, as was expected, the fork allowed t

Re: multiple system commands

2006-03-10 Thread Saurabh Singhvi
i got the following error while trying to install spork Checking if your kit is complete... Looks good Warning: prerequisite version 0 not found. Could not eval ' package ExtUtils::MakeMaker::_version; no strict; local $VERSION; $VERSION=undef; do {

Re: Forcing order

2006-03-10 Thread Ron Smith
--- Chris Devers <[EMAIL PROTECTED]> wrote: > On Thu, 9 Mar 2006, Ron Smith wrote: > > > How can I assure printing the correct order? > > You can't guarantee the order of keys in a hash per > se. For efficiency > and optimization, hashes are stored in a random > order, unlike arrays, > which d

Re: Unable to read timestamp for remote files

2006-03-10 Thread Jay Savage
On 3/10/06, Nath, Alok (STSD) <[EMAIL PROTECTED]> wrote: > Hi, > When I try to retrieve the timestamp from a ftp folder I get > this error message : >>> Can't call method "mtime" on an undefined value at func.pl > line 69 > > but the same works in my local machin

RE: XML Parsing error - regex problem?

2006-03-10 Thread Graeme McLaren
Hi all, I've worked out that the character is a type of apostrophe which has a hex value of 92. How would I write my regex to substitute this character for a normal apostrophe? I've tried: s/92/'/g; and it didn't work. Any ideas? From: "Graeme McLaren" <[EMAIL PROTECTED]> To: beginners

Re: Perl/CGI detecting status of radio button

2006-03-10 Thread Jeff Pang
>so how could I implement it, please? Give your codes here please.As someone here said,'no code,no help'. >I'm not sure if CGI supports some functions directly? If I remember that correctly,the 'param()' function could do the things for you. Execute 'perldoc CGI' and search for 'radio',you cou

Re: Perl/CGI detecting status of radio button

2006-03-10 Thread Nan Jiang
so how could I implement it, please? I'm not sure if CGI supports some functions directly? Nan From: Chris Devers <[EMAIL PROTECTED]> Reply-To: beginners@perl.org To: Nan Jiang <[EMAIL PROTECTED]> CC: beginners@perl.org Subject: Re: Perl/CGI detecting status of radio button Date: Fri, 10 Mar

Re: Perl/CGI detecting status of radio button

2006-03-10 Thread Chris Devers
On Fri, 10 Mar 2006, Nan Jiang wrote: > I would like to ask if some of you know how to use perl to detect the > status (checked or unchecked) of a radio button from a HTML form? Yes. Some of us do know how to do this. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additio

Unable to read timestamp for remote files

2006-03-10 Thread Nath, Alok (STSD)
Hi, When I try to retrieve the timestamp from a ftp folder I get this error message : >> Can't call method "mtime" on an undefined value at func.pl line 69 but the same works in my local machine. My motive is to read the timestamp for each files in the

Re: how to work with ^@ ^M ^D etc. ?

2006-03-10 Thread Eugeny Altshuler
> > How to replace character which looks in vim like ^@ ^M ^D ? > s/\cM/###/g; Great! Thanks! Altshuler Eugeny -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Perl/CGI detecting status of radio button

2006-03-10 Thread Thomas Bätzler
Nan Jiang <[EMAIL PROTECTED]> asked: > I would like to ask if some of you know how to use perl to > detect the status (checked or unchecked) of a radio button > from a HTML form? http://www.elated.com/tutorials/programming/perl_cgi/form_validation/ HTH, Thomas -- To unsubscribe, e-mail: [EMAIL

Parallel Port Error

2006-03-10 Thread LinuxMurah . com
Dear Friends, I have Perl module for Parallel Port installed on my Ubuntu Linux, but when I try to run my program, listed below: use Device::ParallelPort; my $port = Device::ParallelPort->new(); I got this following error: [EMAIL PROTECTED]:/home/ubuntu/Desktop/perl$ sudo perl par.pl Device::Pa

Re: how to rewind file?

2006-03-10 Thread John W. Krahn
nishanth ev wrote: >> --- [EMAIL PROTECTED] wrote: >> >>After I use <> operator on s file handle, I need >>read it from head again. I >>found these is no rewind function, must I close it >>and open again? > > You can use sysseek function. > For more info use perldoc perlfunc > or the following li

Perl/CGI detecting status of radio button

2006-03-10 Thread Nan Jiang
Hello everyone, I would like to ask if some of you know how to use perl to detect the status (checked or unchecked) of a radio button from a HTML form? many thanks, Nan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

XML Parsing error - regex problem?

2006-03-10 Thread Graeme McLaren
Hi all, I'm getting the following XML parsing error: [Fri Mar 10 09:37:39 2006] insert_xml.pl: not well-formed (invalid token) at line 13628, column 24, byte 413248: [Fri Mar 10 09:37:39 2006] insert_xml.pl: LA14 [Fri Mar 10 09:37:39 2006] insert_xml.pl: 5741726 [Fri Mar 10 09:37:39 2006] inser

答复: I found perlcc(distributed w ith ActiveState Perl) is useless mostly :(

2006-03-10 Thread zhao_bingfeng
smime.p7m Description: S/MIME encrypted message