Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • And the tests pass. But if I put my @a it fails. (If I put our @a, it passes.)

    No test of the numbers returned? :)

    • 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.

      • No, neither glob reference nor symbolic reference. A "regular" package variable. Run Deparse over it to see what the optree is:

        $ ./perl -Ilib -MO=Deparse  t/op/unshift.t
        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";
        t/op/unshift.t syntax OK

        There's similar ob