Am Dienstag, 10. Mai 2005 09.14 schrieb FreeFall:
> use warnings;
> use strict;
>
> my @decimals;
> $_ =  'atom 12 N  VAL  A  1  12.435  13.66 34.6  32.1 32   a N';
> push @decimals,$1 while (/(\d+\.?\d*)/g);
>
> print "@decimals\n";

Or, shorter (no need to use while _and_ //g):

use warnings;
use strict;
$_ =  'atom 12 N  VAL  A  1  12.435  13.66 34.6  32.1 32   a N';
my @decimals= /(\d+\.?\d*)/g;
print "@decimals\n";

# prints the same:

12 1 12.435 13.66 34.6 32.1 32

joe

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to