On Thursday, Nov 4, 2004, at 10:49 US/Central, Scott Pham wrote:
Why don't you just split the line and use the whitespace as separator?

$line =~ s/\s+/ /;
my ($record,$date,$cust,$temp1,$temp2,$temp3,$temp4,$temp5,$shipping,$paid )
= split (/ /,$line);

As I was reminded the other day, split works with an RE, so you can skip that first list :


$ perl -e 'my $line = "31232000 07/28/04 DUC000 NET 60 DAYS      " .
  "RD    222264       UPSGNDSVR   PREPAID";
  my ($cust,$shipping) = (split (/\s+/,$line))[2,-2];
  print "$cust, $shipping\n";'
DUC000, UPSGNDSVR

But all that depends on the formatting of the input lines.

Regards,
- Robert
http://www.cwelug.org/downloads
Help others get OpenSource.  Distribute FLOSS for
Windows, Linux, *BSD, and MacOS X with BitTorrent


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to