The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

C++ to Perl by dennismv2007-05-18 12:19:08
  Simple. by Pic 2007-05-18 12:22:49
sub increment_tuple {
    my ($arg) = @_;

    my $new = [];
    $new->[0] = $arg->[0] + 1;
    $new->[1] = $arg->[1] + 1;
    return $new;
}

my $tuple = [3, 4];
$tuple = increment_tuple($tuple);
print "$tuple->[0] $tuple->[1]\n";
It can be OO-ified if you want that as well, with a bit more code.
[ Reply ]
    thanks! by dennismv2007-05-18 12:29:15
      By OO-fied, by Pic2007-05-18 12:36:29
        oh I see by dennismv2007-05-18 12:40:28
    Last line could be print "@$tuple\n" by hobbs2007-05-18 15:27:37

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)