in reply to Regex refresher
If you only wanted the first three elements:print join(",",split(/\s+/,$line,7)),"\n";
There doesn't seem to be a need for more complex regular expressions unless you're attempting to validate the data or the delimiting spaces are missing sometimes.print join(",",+(split(/\s+/,$line,4))[0 .. 2]),"\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex refresher
by xicheng (Sexton) on Mar 22, 2007 at 16:20 UTC |