in reply to Space inserted into output file
However, when you don't want the default space separator, just don't put the array in quotes! There is no need for the extra overhead of joining with a null string. Also no need to redefine the output record separator.
#!/usr/bin/perl use strict; use warnings; my @array = (qw/A B C D E F/); print "array has ".@array," elements\n"; ## array has 6 elements # Note the above '.' puts @array into a scalar context print "@array\n"; ## 'A B C D E F' print "",@array,"\n"; ## 'ABCDEF' #note: added null string"" added so that print is not # confused about missing optional FileHandle. Note comma ',' # used instead of '.' as joining character.
|
|---|