in reply to Re^4: Extract varibles from 2 text files and make a report
in thread Extract varibles from 2 text files and make a report
For info on using split see split.
Hmmm... Spaces at the begining of the line... At this point it may be better to simply split on "\n" and then parse the line... This is a confusing line of code:
@prods = map({/(\S+)/} split(/\n/, $prod));
So I'll also give it to you in a more broken out way.
@prods = split(/\n/, $prod); foreach my $line (@prods){ $line =~ s/^\s*(\S+).*$/$1/; }
But it might be better to do it like this:
@prods = ($prod =~ m/(?:\A|\n)\s*(\S+)/g);
Yeah, I think I like the last way the best. It is probably faster too, but I haven't tested that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Extract varibles from 2 text files and make a report
by Anonymous Monk on Oct 26, 2004 at 20:30 UTC |