今日Perl Tip. 配列をプリントアウトしたいぜ!
ウンワックック。今日の、3分間ちっぷすだよ。配列をプリントアウトすると、スペースで区切られるけど、
それって、$" の値だから、それを変えちゃうと、ハァハァだよ!
#!/usr/bin/perl use strict; use warnings; my @food = qw/sashimi yakiniku purin/; print "I love this food![ @food ]\n"; local $" = ', '; print "I love this food![ @food ]\n";
結果。
I love this food![ sashimi yakiniku purin ] I love this food![ sashimi, yakiniku, purin ]