use strict;
use warnings 'all';
use constant {
EMAIL => 17,
CONTACTME => 27,
SKUTITLE => 34
};
my @records; # Arrays are initialised empty; no need to do it explicitly.
push @records, [ split "\t" ] for <>;
do { tr/"//d for @$_ } for @records;
my @contact_records;
do { push @contact_records, [ @$_[ SKUTITLE, CONTACTME, EMAIL ] ] if $_->[CONTACTME] == 1 } for @records;
{
local $, = "\t";
local $\ = "\n";
print @$_ for sort { $a->[0] cmp $b->[0] } @contact_records;
}
####
use strict;
use warnings 'all';
use constant {
EMAIL => 17,
CONTACTME => 27,
SKUTITLE => 34
};
{
local $, = "\t";
local $\ = "\n";
print @$_ for
sort { $a->[0] cmp $b->[0] }
grep { $_->[1] }
map {
chomp;
[
map { substr $_, 1, -1 }
( split "\t" )[ SKUTITLE, CONTACTME, EMAIL ]
]
} <>;
}
##
##
sub snip_or_toss { $_[CONTACTME] ? @_[ SKUTITLE, EMAIL ] : () }