Maybe I'm missing the point but isn't the following code the problem's answer? Please let me know if I am off base.
Thank you; Sherman #!/usr/bin/perl my @test = "a b c"; ($test)=(@test); print "\$test: $test\n"; @test = "a b c"; $test = @test; print "\$test: $test\n"; # output lines after running this file # $test: a b c # $test: 1 On Thu, May 29, 2014 at 2:45 PM, Shawn H Corey <[email protected]> wrote: > On Thu, 29 May 2014 13:36:11 -0700 > Jim Gibson <[email protected]> wrote: > > > Try it yourself: > > > > % perl -e '@t=qw(1 2 3);$t=@t;print qq($t\n);' > > 3 > > % perl -e '@t=qw(1 2 3);($t)=@t;print qq($t\n);' > > 1 > > % perl -e '@t=qw(1 2 3);($t)=(@t);print qq($t\n);' > > 1 > > This would be clearer if you used letters: > > $ perl -E'@t=qw( a b c );$t=@t;say$t' > 3 > $ perl -E'@t=qw( a b c );($t)=@t;say$t' > a > $ perl -E'@t=qw( a b c );($t)=(@t);say$t' > a > > > -- > Don't stop where the ink does. > Shawn > > -- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > http://learn.perl.org/ > > >
