getting a number out of a string....
- From: dowda@xxxxxxxxxxxxxxxxxx (David Gilden)
- Date: Wed, 28 Dec 2005 18:57:10 -0600
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 musician / audiophile / webmaster @ www.coraconnection.com / Ft. Worth, TX, USA)
Endorsing Artist for the Moog Music:
<http://www.moogmusic.com/artists.html?cat_id=25>
==============================================
Cora Connection: Your West African Music Source
Resources, Recordings, Instruments & More!
<http://www.coraconnection.com/>
==============================================
.
- Follow-Ups:
- Re: getting a number out of a string....
- From: Paul Lalli
- Re: getting a number out of a string....
- From: Todd W
- Re: getting a number out of a string....
- From: Chris Devers
- Re: getting a number out of a string....
- Prev by Date: RE: running a short perl script in a windows XP arena
- Next by Date: Re: getting a number out of a string....
- Previous by thread: running a short perl script in a windows XP arena
- Next by thread: Re: getting a number out of a string....
- Index(es):