> Bryan R Harris <mailto:[EMAIL PROTECTED]> wrote: > : I'd like to snag all the whitespace padded numbers in $_ into an > : array, e.g. in the following: > : > : 1 "M_fx,-3,+2.p2" -31.4e-1 4. > > Can you give more than one example?
The script is intended to normalize all the data in a file. It already worked fine for most things until I ran it on a file that had filenames in one column where the filenames had numbers in them. I didn't want it to see numbers wedged into other strings. It's supposed to be a generic tool to normalize the data in any file. > If everything fits this form, then don't look for numbers. > Just delete strings with starting ". > > use strict; > use warnings; > use Data::Dumper 'Dumper'; > > my $string = ' 1 "M_fx,-3,+2.p2" -31.4e-1 4. '; > > my @numbers = grep ! m/^"/, split ' ', $string; > > # or my @numbers = ( split ' ', $string )[0, 2, 3]; > > print Dumper [EMAIL PROTECTED]; > > __END__ On an unrelated note, I've been very hesitant to use modules -- ever. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>