If you just print an array (as in print @_) there will be nothing to show where each element starts and ends:
$ perl -e '@_ = qw{a bcd ef}; print @_' abcdef
If you put the array in interpolating quotes, you will see each element separated by the value of the special variable $" (which, by default, is a space):
$ perl -e '@_ = qw{a bcd ef}; print "@_"' a bcd ef $ perl -e '@_ = qw{a bcd ef}; print qq{@_}' a bcd ef
In rare situations, perhaps where $" was changed elsewhere in the code, you may want to make a localised change to $" (typically within an anonymous block). See local, "Temporary Values via local()" and "Localization of special variables" for more details on that. Some examples:
$ perl -e '@_ = qw{a bcd ef}; { local $" = " "; print "@_" }' a bcd ef $ perl -e '@_ = qw{a bcd ef}; { local $" = "__"; print "@_" }' a__bcd__ef $ perl -e '@_ = qw{a bcd ef}; { local $" = "\n"; print "@_" }' a bcd ef
— Ken
In reply to Re^5: Splitting in while loop
by kcott
in thread Splitting in while loop
by tel2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |