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."
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.