Hi,
my $foo = 'http://10.20.30.40/gargle';
my ($fee) = $foo =~ /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/g;
Note the /g at the end.
Octavian
----- Original Message -----
From: [EMAIL PROTECTED]
To: [email protected]
Sent: Monday, January 08, 2007 9:45 PM
Subject: Capturing parens regexp in one line?
Gurus,
I've not seen this done, so I don't know if it can be, but... Is there a way
to get $1 from a pair of parens in a regexp into a variable in one line? That
is...
my $foo = 'http://10.20.30.40/gargle';
$foo =~ /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/;
my $fee = $1;
print "IP = \"$fee\"\n";
...is there some way to get the second and third lines into one line?
Deane Rothenmaier
Systems Architect
Walgreens Corp.
847-914-5150
"Science is not only compatible with spirituality; it is a profound source of
spirituality." -- Carl Sagan
------------------------------------------------------------------------------
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs