my (undef, @headings) = split ' ', first {/^\s*AUID/} @lines;
####
my @headings = splice @{[
split ' ', (grep /^\s*AUID/, @lines)[0] ]}, 1;
####
my @headings = splice @{[ split ' ', first {/^\s*AUID/} @lines ]}, 1;
####
my @headings = map {/(?!^\s*AUID)\s(\S+)/g} first {/^\s*AUID/} @lines;
####
my @headings = (first {/^\s*AUID/} @lines)=~/(?!^\s*AUID)\s(\S+)/g;
####
use warnings;
use strict;
use Test::More tests=>6;
use List::Util qw/first/;
my @lines = ("AUID \cIRA \cIDec \cILabel \cIV \cIB-V \cIComments",
'hello','world');
my @expect = ('RA', 'Dec', 'Label', 'V', 'B-V', 'Comments');
{
my @headings = grep /^\s*AUID/, @lines;
@headings = split ' ', $headings[0];
shift @headings;
is_deeply \@headings, \@expect or diag explain \@headings;
}
{
my @headings = splice @{[
split ' ', (grep /^\s*AUID/, @lines)[0] ]}, 1;
is_deeply \@headings, \@expect or diag explain \@headings;
}
{
my @headings = splice @{[
split ' ', first {/^\s*AUID/} @lines ]}, 1;
is_deeply \@headings, \@expect or diag explain \@headings;
}
{
my @headings = map {/(?!^\s*AUID)\s(\S+)/g}
first {/^\s*AUID/} @lines;
is_deeply \@headings, \@expect or diag explain \@headings;
}
{
my @headings = (first {/^\s*AUID/} @lines)=~/(?!^\s*AUID)\s(\S+)/g;
is_deeply \@headings, \@expect or diag explain \@headings;
}
{
my (undef, @headings) = split ' ', first {/^\s*AUID/} @lines;
is_deeply \@headings, \@expect or diag explain \@headings;
}