I was looking at t/op/unshift.t, and it's a bit strange:
#!./perl
print "1..2\n";
@a = (1,2,3);
$cnt1 = unshift(a,0);
if (join(' ',@a) eq '0 1 2 3') {print "ok 1\n";} else {print "not ok 1\n";}
$cnt2 = unshift(a,3,2,1);
if (join(' ',@a) eq '3 2 1 0 1 2 3') {print "ok 2\n";} else {print "not ok 2\n";}
There's no @ on the arrays passed to unshift. That's Perl 1 syntax.
Well, that's because it turns out that every line in that test is verbatim from the Perl 1.0 release test suite. Check out the "blame". I was going to tweak it to use a library for its tests, which would generate nice diagnostics on failure, but given how "1st edition" it is, I don't feel like doing that now.
oh, my (Score:0)
And the tests pass. But if I put
my @ait fails. (If I putour @a, it passes.)No test of the numbers returned? :)
Re: (Score:2)
But if I put my @a it fails. (If I put our @a, it passes.)
So, what is this, actually? Something like a glob reference? Or worse: a symbolic reference?
It reminds me of the syntax for filehandles.
Re: (Score:2)
Deparseover it to see what the optree is:There's similar ob