in reply to Re: Perl split on regex match
in thread Perl split on regex match
Hi Athanasius
Why do you print join ',', @cols when you already have $line in scope, with the complete line in it?
I would be tempted to drop the chomp too, as we are never looking that far down the line. Then we have this code...
use strict; use warnings; while (my $line = <DATA>) { my @cols = split /,/, $line; my @third = split /\./, $cols[2]; print $line if @third < 3; }
Cheers,
R.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Perl split on regex match
by GotToBTru (Prior) on Jan 03, 2017 at 15:17 UTC | |
by 1nickt (Canon) on Jan 03, 2017 at 15:35 UTC | |
by Random_Walk (Prior) on Jan 03, 2017 at 17:36 UTC | |
by GotToBTru (Prior) on Jan 03, 2017 at 18:59 UTC | |
by Random_Walk (Prior) on Jan 04, 2017 at 13:44 UTC |