Re: getting a number out of a string....

2005-12-29 Thread David Gilden
Chris, Thanks and Happy New Year. Dave (kora musician / audiophile / webmaster @ www.coraconnection.com / Ft. Worth, TX, USA) > > How does one just get the number part out of a string? > > > > The script below just prints 1. > > Right. All it's doing is reporting a successful, true, match. >

Re: getting a number out of a string....

2005-12-28 Thread Todd W
"David Gilden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Greetings, > > How does one just get the number part out of a string? > > The script below just prints 1. > > #!/usr/bin/perl > > @str = ('Gambia001.tiff','Gambia0021.tiff','Gambia031.tiff','Gambia035.tiff') ; > > foreach

Re: getting a number out of a string....

2005-12-28 Thread Chris Devers
On Wed, 28 Dec 2005, David Gilden wrote: > How does one just get the number part out of a string? > > The script below just prints 1. Right. All it's doing is reporting a successful, true, match. You need to fix where the parentheses are being used: > foreach $str (@str) { > $num = ($str

getting a number out of a string....

2005-12-28 Thread David Gilden
Greetings, How does one just get the number part out of a string? The script below just prints 1. #!/usr/bin/perl @str = ('Gambia001.tiff','Gambia0021.tiff','Gambia031.tiff','Gambia035.tiff') ; foreach $str (@str) { $num = ($str =~ /\d+/); print "$str : $num\n"; } Thanks! Dave Gilden (kora