in reply to Splitting Array with Variable Spaces
If you are *sure* that the entries are separated by spaces and not by tabs AND THAT no entry will contain spaces, you can use the highly effective:
my @fields = split /\s+/, $data_line;
To split on "one or more bits of whitespace" (tabs, carriage returns, newlines, etc.). If you want to match spaces specifically, change the \s to a space.
perlman:perlre for all the goodness of Perl regexen.
Philosophy can be made out of anything. Or less -- Jerry A. Fodor
|
|---|