Grey Fox has asked for the wisdom of the Perl Monks concerning the following question:
#!/pw/prod/svr4/bin/perl use strict; use warnings; undef $/; my $data = <DATA>; $data =~ m{(\d+-)(\d+-)(\d+)(\s*/\s*)(\d+)(\s*/\s*)(\d+)}g; print "$1, $2, $3, $4, $5, $6, $7\n"; __DATA__ PART NAME QUANTITY SECTION/FIGURE/ITEM Widget1 1 72-33-00/ 23/ 85 Widget1 1 75-20-00/ 11/ 10 Widget2 1 72-33-00/20/10 Widget2 1 72-33-00/20/70 Widget2 1 72-00-33/2/1 Widget2 1 72-00-33/2/20 Widget2 1 73-12-00/4/1 Widget2 1 73-12-00/4/220 Widget2 1 73-12-00/3/10 Widget2 2 79-20-00/9/1 Widget2 1 79-20-00/5/1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to capture all occurances from a slurped file.
by shmem (Chancellor) on Aug 24, 2006 at 22:04 UTC | |
by Grey Fox (Chaplain) on Aug 24, 2006 at 23:21 UTC | |
|
Re: How to capture all occurances from a slurped file.
by imp (Priest) on Aug 24, 2006 at 22:14 UTC |