#!/usr/bin/perluse strict;use warnings;my%fruit;$fruit{'ap'.'ple'}=1;$fruit{'banana'}=2;$fruit{'peach'}=3;foreachmy$choice(qw(apple banana peach x)){print"$fruit{$choice}\n"}#1#2#3#Use of uninitialized value within %fruit in concatenation (.) or string at test.pl line 13.#my%letter=('a',1,'b',2,'c','c1');foreachmy$key(keys %letter){print"$letter{$key}\n";}#2#1#c1my@arr=%letter;print"@arr\n";#c c1 b 2 a 1my%new=%letter;foreachmy$key(keys %new){print"$new{$key}\n";}#1#c1#2my%reverse= reverse %letter;foreachmy$key(keys %reverse){print"$reverse{$key}\n";}#b#c#amy%test=('a'=>1,'b'=>2,'c'=>1,);my%reverse_test= reverse %test;foreachmy$key(keys %reverse_test){print"$reverse_test{$key}\n";}#b#c#bmy@k= keys %test;print"@k\n";my@v= values %test;print"@v\n";#c a b#1 1 2if(%test){print"r!\n"}#r!$test{'d'}=0;$test{'e'}=undef;while(my($k,$v)= each %test){print"$k => $v\n";}#Use of uninitialized value $v in concatenation (.) or string at test.pl line 90.#e =>#d => 0#b => 2#c => 1#a => 1if(exists $test{'r'}){print"get!\n";}else{print"nothing!\n";}#nothing!if(exists $test{'e'}){print"get!\n";}else{print"nothing!\n";}#get!delete$test{'e'};if(exists $test{'e'}){print"get!\n";}else{print"nothing!\n";}#nothing!print"%test\n";#%testprint"$ENV{PATH}\n";
posted on
2019-06-16 19:30YUANya
阅读(115)
评论(0)
编辑收藏举报