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.
>
"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
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
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