Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Ice cream and cake!

by bv (Friar)
on Sep 12, 2009 at 18:53 UTC ( #794937=poem: print w/ replies, xml ) Need Help??

Hint

#!/usr/bin/perl use 5.10.0;use strict; my ($ice_cream, $cake, @cookies); verse1( $ice_cream, $cake & $cake ); verse2( $ice_cream & $cake ); verse3( split /,/, "slip,"x3 . "slide" ); verse4(); verse2( $ice_cream and $cake ); map { s/_/ /g; say $_," ice cream n cake" } qw( Now_who_dat_is_with_the Party_aint_live_without_the Whatcha_wa +nt_some All_the_kids_like ); verse2( "$ice_cream and $cake" ); verse3( ("slip,"x3 . "slide") =~ m/(\w*)/g ); verse4(); verse2( $ice_cream && $cake ); verse1( $ice_cream, $cake + $cake ); ($ice_cream and @cookies) xor eat($ice_cream, @cookies); sub verse1 { for ( 1 .. 4 ) { say $_[0] and $_[1]; } } sub verse2 { for ( 1 .. 4 ) { say $_[0]; do{ $_[0] }; } } sub verse3 { say time, join(', ', @_); say join(', ', @_[0..2]) and $_[3] for (1 .. 2); $SIG{STOP} = sub { sleep 1; TAG_TEAM: } } sub verse4 { my $boy; $SIG{ALRM} = sub { say "slip n slide" }; ride( $boy ), kill (ALRM, $$) for (1 .. 3); sleep 1; map { $_++ } ($ice_cream, $cake); } sub ride { say "Whee!" }; sub eat { say "YUM!"; } __END__
print pack("A25",pack("V*",map{1919242272+$_}(34481450,-49737472,6228,0,-285028276,6979,-1380265972)))

Comment on Ice cream and cake!
Select or Download Code
Re: Ice cream and cake!
by pmonk4ever (Friar) on Sep 16, 2009 at 21:21 UTC
    I received the following error when executing your poem: "Bareword "ALRM" not allowed while "strict subs" in use at poem.pl line 44."

    These lines:

    $SIG{ALRM} = sub { say "slip n slide" }; ride( $boy ), kill (ALRM, $$) for (1 .. 3);
    Any ideas?


    pmonk4ever

    "No trees were harmed in the creation of this comment. However, a rather large number of electrons were somewhat inconvenienced."

      Yeah, I wasn't able to really test that line because of running on Windows (see node Signals in Strawberry Perl: Name or number? for further discussion). On UNIX, change it to kill ('ALRM', $$) and it should work. Note, however, that there is no meaningful output. It's just for the fun of reading the code.

      print pack("A25",pack("V*",map{1919242272+$_}(34481450,-49737472,6228,0,-285028276,6979,-1380265972)))
        I am running ActiveState Perl 5.10.0 on WinXP, with 'use warnings;' & after commenting verse4 out, I received the following errors:

        1253205291slip, slip, slip, slide slip, slip, slip slip, slip, slip Use of uninitialized value $_[0] in say at poem.pl line 30. Use of uninitialized value $_[0] in say at poem.pl line 30. Use of uninitialized value $_[0] in say at poem.pl line 30. Use of uninitialized value $_[0] in say at poem.pl line 30. Modification of a read-only value attempted at poem.pl line 12. Current invocation: #!c:\Perl\bin\perl.exe use 5.10.0; use strict; use warnings; my ($ice_cream, $cake, @cookies); verse1( $ice_cream, $cake & $cake ); verse2( $ice_cream & $cake ); verse3( split /,/, "slip,"x3 . "slide" ); #verse4(); verse2( $ice_cream and $cake ); map { s/_/ /g; say $_," ice cream n cake " } qw( Now_who_dat_is_with_the Party_aint_live_without_the Whatcha_wa +nt_some All_the_kids_like ); verse2( "$ice_cream and $cake" ); verse3( ("slip,"x3 . "slide") =~ m/(\w*)/g ); #verse4(); verse2( $ice_cream && $cake ); verse1( $ice_cream, $cake + $cake ); ($ice_cream and @cookies) xor eat($ice_cream, @cookies); sub verse1 { for ( 1 .. 4 ) { say $_[0] and $_[1]; } } sub verse2 { for ( 1 .. 4 ) { say $_[0]; do{ $_[0] }; } } sub verse3 { say time, join(', ', @_); say join(', ', @_[0..2]) and $_[3] for (1 .. 2); $SIG{STOP} = sub { sleep 1; TAG_TEAM: } } sub verse4 { my $boy; $SIG{ALRM} = sub { say "slip n slide" }; ride( $boy ), kill ('ALRM', $$) for (1 .. 3); sleep 1; map { $_++ } ($ice_cream, $cake); } sub ride { say "Whee!" }; sub eat { say "YUM!"; } __END__
        Sorry I seem to be having trouble here, this looked straight-forward to me.

        pmonk4ever

        "No trees were harmed in the creation of this node. However, a rather large number of electrons were somewhat inconvenienced."

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: poem [id://794937]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (10)
As of 2014-08-20 07:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (107 votes), past polls