Salve J. Nilsen wrote: > > print "10 bottles o'beer on the wall,\n". > "10 bottles o'beeer!\n". > "Take one down - pass it a-round,\n". > "9 bottles o'beer on the wall!\n\n"; >.... > __END__ Here's a couple I came up with a while back. $" = " bottles of beer"; $, = " on the wall\n"; @%=<<'"'=~/(.*?\n)(.*)/s; take one down, pass it around go to the store, buy some more " $\ = "\n"; print map{$_?(qq{ @{[$_,'']}},qq{@{[$_,'']} @{[$%[$_==1]]}@{[(($_-1)||9),'']}}):''}reverse 0..9; Notes: The newlines in the last three lines are essential for proper output formatting. This version has the disadvantage of going to the store when there's one bottle on the wall, instead of none. Another one: $"="\n"; tie @refrain, 'Refrain'; print "@refrain[reverse 0..9]"; And to be able to use it, you need to include this: package Refrain; sub TIEARRAY { bless [], $_[0] } sub FETCH { my( $self, $i ) = @_; my $a = $i || 'no'; my $b = ( 'go to the store, buy some more', 'take one down, pass it around' )[$i<=>0]; my $c = ( $i-1, 'no', 99 )[(0<=>$i-1)+1]; <<text $a bottles of beer on the wall $a bottles of beer $b $c bottles of beer on the wall text } Cheers, John Porter ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe