in reply to What is the fastest way to extract data from a delimited string?

If you only need up to the 6th column, you might try supplying the third argument to split so it will stop splitting after the 6th column. If you're on Unix or have unix tools, and you only need the one column, you might try using cut or awk:
open(FH, 'cut -d" " -c6 file|') or die $!; # or open(FH, "awk '{print \$6}' file|") ... while(<FH>) { ... } close FH or die $!; # Check close on pipe opens # Also, you might try a regex which # uses qr and only saves what you want my $re = qr/(?:\S+\s+){5}(\S+)/; ... while (<FH>) { next unless $_ =~ $re; my $field = $1; ... }
Updated.
  • Comment on Re: What is the fastest way to extract data from a delimited string?
  • Download Code