As a project to teach myself more syntax, I decided to do a simple JAPH. So now I present, my first JAPH (please comment, and further learn me on the arts of JAPH:

perl() ; sub perl {$h = "hacker" ; @j = qw(Perl Just Rocks); @j=(@j, "another"); $j[2] = $h ; @j = ($j[1], $j[3], $j[0], $j[2] ) ; print "\n@j[0 .. 3]\;\n" ; }

PS: It doesn't seem to return any errors for me...even with the -w flag.

Replies are listed 'Best First'.
RE: My first JAPH (a project to learn more perl)
by chromatic (Archbishop) on Sep 28, 2000 at 08:05 UTC
    I suppose trying to reduce this too far will end up with a single print statement. However, here's a more concise version:
    perl(); sub perl { $h = "hacker"; @j = qw(Perl Just Rocks); $j[$#j+1]=("another"); print "\n@j[1, 3, 0] $h;\n"; }
    Well... concise with a little more punctuation.
      Wouldn't the pound sign (#) in the second line make the rest of that line a remark?
        No.

        $# returns the subscript of the last element in an array. So if you'd have an array called @array with six elements, $#array would return 5:
        qw(one two three four five six); print $array[$#array]; # prints "six"
        $j[$#j+1] = ("another");
        is actually just obfuscation for this:
        push @j, "another";

        [~]