scalar EXPR |
強製計算EXPR在標量上下文中,即使它會在列表環境中正常工作。
標量(Scalar)
#!/usr/bin/perl -w #by www.gitbook.net @a = (1,2,3,4); @b = (10,20,30,40); @c = ( @a, @b ); print "1 - Final Arrary is @c\n"; @c = ( scalar(@a), scalar(@b) ); print "2 - Final Arrary is @c\n";
這將產生以下結果:
1 - Final Arrary is 1 2 3 4 10 20 30 40
2 - Final Arrary is 4 4