Re: problem with simple perl Regular Expression match

2008-11-11 Thread JC Janos
On Tue, Nov 11, 2008 at 4:23 PM, Chas. Owens <[EMAIL PROTECTED]> wrote: > From http://search.cpan.org/dist/libwww-perl/lib/LWP/Simple.pm#mirror Sure. I've read the manual. I asked my question because the manual wasn't clear to me. It still isn't. But anyway, I figured out what happens by trial

Re: problem with simple perl Regular Expression match

2008-11-11 Thread Chas. Owens
On Tue, Nov 11, 2008 at 15:38, JC Janos <[EMAIL PROTECTED]> wrote: > Chas, > >> my $status = mirror($url, $file); >> >> if ($status == RC_OK) { >>print "got file\n"; >> } elsif ($status == RC_NOT_MODIFIED) { >>print "didn't need to get the file\n"; > > That's a good example, thanks.

Re: Using perl in a Bash-script to extract IP-addresses?

2008-11-11 Thread John W. Krahn
Chas. Owens wrote: On Mon, Nov 10, 2008 at 21:40, Rob Dixon <[EMAIL PROTECTED]> wrote: John W. Krahn wrote: Why not just: ipaddy=`awk '{ print $1 }' ipin.txt` But that still doesn't get you a comma-separated list. Erm, a Perl list? Rob Hey, if you throw an @ in front of ipaddy you get a P

Re: to read a line 2 lines above a line having a grepped string...

2008-11-11 Thread Dr.Ruud
dilip schreef: > suppose i have a file having the following data.. > > SN = TOM > FDN = SALLY > OPERATIONAL STATE = ENABLED > > Now suppose i grep the string "ENABLED", i get the third line.But from > this very line i need to go 2 lines above and get the SN value > also.Please suggest . > > regard

Re: problem with simple perl Regular Expression match

2008-11-11 Thread JC Janos
Chas, > my $status = mirror($url, $file); > > if ($status == RC_OK) { >print "got file\n"; > } elsif ($status == RC_NOT_MODIFIED) { >print "didn't need to get the file\n"; That's a good example, thanks. LWP looks like a good alternative; one question ... As I use "wget --timesta

getting data from URL

2008-11-11 Thread Brian
Hello Having tested my code locally with PERL, I am now playing with it as cgi. So far I have only been using 1 ARGV value and would like to add another one into my calcs, so value1 = $ARGV[0] and value2 = $ARGV[1] In my html I am using a couple of radio buttons, a textfield, and a submit bu

Re: problem with simple perl Regular Expression match

2008-11-11 Thread Chas. Owens
On Tue, Nov 11, 2008 at 11:38, JC Janos <[EMAIL PROTECTED]> wrote: > I stumbled on an answer. Adding "2>&1" apparently works, i.e., > > $result = `2>&1 $WGET $file`; > > Not sure if it's the only/best way. snip Well, the best way would be to use LWP*, LWP::Simple**, or WWW::Mechanize*** to allow

Re: problem with simple perl Regular Expression match

2008-11-11 Thread JC Janos
I stumbled on an answer. Adding "2>&1" apparently works, i.e., $result = `2>&1 $WGET $file`; Not sure if it's the only/best way. --JC -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: problem with simple perl Regular Expression match

2008-11-11 Thread JC Janos
Hi Rob, On Tue, Nov 11, 2008 at 8:14 AM, Rob Coops <[EMAIL PROTECTED]> wrote: > I am not 100% certain but I would say because in the first instance $WGET > $file does not result in anything, the printed line is not printed by your > program but by the wget command. > > Try modifying your script to

Re: problem with simple perl Regular Expression match

2008-11-11 Thread Rob Coops
On Tue, Nov 11, 2008 at 5:03 PM, JC Janos <[EMAIL PROTECTED]> wrote: > When I run this script, > >$result = `$WGET $file`; >print $result . "\n"; >if ( $result =~ m/saved/ ){ >print "MATCH\n"; >} else { >print "NO MATCH\n"; >} > > It

problem with simple perl Regular Expression match

2008-11-11 Thread JC Janos
When I run this script, $result = `$WGET $file`; print $result . "\n"; if ( $result =~ m/saved/ ){ print "MATCH\n"; } else { print "NO MATCH\n"; } It outputs, 2008-11-11 07:43:34 (526 KB/s) - `test.zip' saved [1517245/151724

Re: insert keyword

2008-11-11 Thread Sharan Basappa
>> Hi, >> >> I have a string that has value delimited by space >> e.g. 1 2 10 8 etc. >> >> I need to add a keyword wherever there is a space. >> I wrote a small code to try this out: >> >> $str = "one two three"; >> $str =~ s/\s/x /g; >> >> In this case, I am trying to insert x where there is a spa

Re: algorithm permute

2008-11-11 Thread Chas. Owens
On Mon, Nov 10, 2008 at 12:36, Paul Lalli <[EMAIL PROTECTED]> wrote: snip > "elsewhere" is the problem. Algorithm::Permute is not a built-in > module. You have to install it manually via the CPAN on every machine > you want to use it. snip Another option (if installing modules is, for some reaso

Re: algorithm permute

2008-11-11 Thread Sharan Basappa
Hi Paul, Regards On Mon, Nov 10, 2008 at 11:06 PM, Paul Lalli <[EMAIL PROTECTED]> wrote: > On Nov 10, 9:15 am, [EMAIL PROTECTED] (Sharan Basappa) wrote: >> Hi, >> >> After working fine with Algorithm::Permute module for weeks now, >> suddenly I seem to be getting errors. >> >> The particular er

Re: Using perl in a Bash-script to extract IP-addresses?

2008-11-11 Thread Chas. Owens
On Mon, Nov 10, 2008 at 21:40, Rob Dixon <[EMAIL PROTECTED]> wrote: > John W. Krahn wrote: >> >> Why not just: >> >> ipaddy=`awk '{ print $1 }' ipin.txt` >> >> But that still doesn't get you a comma-separated list. > > Erm, a Perl list? > > Rob Hey, if you throw an @ in front of ipaddy you get a P

Re: insert keyword

2008-11-11 Thread Chas. Owens
On Mon, Nov 10, 2008 at 09:26, Sharan Basappa <[EMAIL PROTECTED]> wrote: > Hi, > > I have a string that has value delimited by space > e.g. 1 2 10 8 etc. > > I need to add a keyword wherever there is a space. > I wrote a small code to try this out: > > $str = "one two three"; > $str =~ s/\s/x /g; >

RE: to read a line 2 lines above a line having a grepped string...

2008-11-11 Thread Stewart Anderson
> -Original Message- > From: John W. Krahn [mailto:[EMAIL PROTECTED] > Sent: 11 November 2008 13:48 > To: Perl Beginners > Subject: Re: to read a line 2 lines above a line having a grepped > string... > > dilip wrote: > > hi all, > > Hello, > > > suppose i have a file having the followin

Re: to read a line 2 lines above a line having a grepped string...

2008-11-11 Thread John W. Krahn
dilip wrote: hi all, Hello, suppose i have a file having the following data.. SN = TOM FDN = SALLY OPERATIONAL STATE = ENABLED Now suppose i grep the string "ENABLED", i get the third line.But from this very line i need to go 2 lines above and get the SN value also.Please suggest . Someth

RE: to read a line 2 lines above a line having a grepped string...

2008-11-11 Thread Stewart Anderson
> From: dilip [mailto:[EMAIL PROTECTED] > Sent: 11 November 2008 11:18 > To: beginners@perl.org > Subject: to read a line 2 lines above a line having a grepped string... > > hi all, > > suppose i have a file having the following data.. > > SN = TOM > FDN = SALLY > OPERATIONAL STATE = ENABLED >

to read a line 2 lines above a line having a grepped string...

2008-11-11 Thread dilip
hi all, suppose i have a file having the following data.. SN = TOM FDN = SALLY OPERATIONAL STATE = ENABLED Now suppose i grep the string "ENABLED", i get the third line.But from this very line i need to go 2 lines above and get the SN value also.Please suggest . regards' Dilip -- To unsubsc

a request

2008-11-11 Thread loke
Hi everybody. I have observed that sometimes the solution to a problem is not answered to the group but to the individual posting which prevents everybody else from knowing it. I would appreciate if while replying, everyone could replace the to to perl.beginner newsgroup. Loke -- To unsubscrib