>From what I have read from The Camel $1 should contain the matched text. >From that matched text I want to then search for an additional string.
I have this in a file: Connect time 8.3 minutes Connect time 100.1 minutes (etc) $line gets the whole line and from there I wanna place the numerical time into a variable, so that 8.3 would be placed into $sum and then 100.1 added into it so the total would eventually be in $sum. On Friday 26 July 2002 19:28, Mark Anderson wrote: > $1 is a special variable. What are you actually trying to do here? > > What do you want to have print? > > [I've copied you, but please respond to the list.] > > /\/\ark > > -----Original Message----- > From: Steve [mailto:[EMAIL PROTECTED]] > Sent: Friday, July 26, 2002 4:20 PM > To: [EMAIL PROTECTED] > Subject: regex question > > > [ please cc: me as I am on digest and I may miss a reply] > > I have the following snippet of code: > > if($line=~/Connect\s/) { > print $line; > if($1=~/[0-9]/) { > print "$1\n"; > } > } > > The first if is OK, I get what I need. The second if though I get this > when I try to run the script: > Use of uninitialized value in pattern match (m//) at ./conn_time.pl line 19 > What I am looking to do is find a substring in $line > > I am using warnings,diagnostics and strict as well. > > Thanks -- Steve -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]