in reply to Re^6: Perl custom sort for Portuguese Lanaguage
in thread Perl custom sort for Portuguese Lanaguage
If you only want the first lines starting with # to be filtered, that is indeeed what filter is for:
use Data::Peek; use Text::CSV_XS qw( csv ); my $r = 0; my $aoa = csv (in => *DATA, filter => sub { $_[1][0] =~ m/^\s*#/ ? $r +: ++$r; }); DDumper $aoa; __END__ # This is comment # and so is this # and this a,b,c #but,not,this 1,2,3
-->
[ [ 'a', 'b', 'c' ], [ '#but', 'not', 'this' ], [ '1', '2', '3' ] ]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Perl custom sort for Portuguese Lanaguage
by haukex (Archbishop) on Jul 09, 2020 at 14:08 UTC | |
by Tux (Canon) on Jul 09, 2020 at 14:14 UTC | |
by haukex (Archbishop) on Jul 09, 2020 at 14:20 UTC |