What mistake am I making in this code (Perl)? -
use strict; use warnings; %hash = ("no1"=>1, "no2"=>2, ); @array = %hash; print @array; #output: no11no22 print "\n"; $string = print @array; print $string; #output: no11no221
why $string not same @array? why getting 1 @ end? mistake making?
the main problem print
doesn't return string, rather prints out string filehandle (see perldoc -f print
). instead, can let my $string=join('',@array);
Comments
Post a Comment