in reply to Re: how do i do this?
in thread how do i do this?

You mentioned $, but then never used it in your code... In fact, the print statement you have wouldn't be affected by $, anyway. $, is what print displays between its parameters: print $a, $b will actually print $a followed by $, followed by $b.

The special variable for array interpolation is $". It is what you would need to set to change what happens in your print statement.

However, anytime you hear "special variable" you need to realize that they are global, and you should avoid changing their global value. This can be done by localized them inside of an enclosing block. If you don't do this, you will introduce hard-to-track-down bugs in other parts of your program. Here is an example using the tips above....

#!/usr/bin/perl -wT use strict; { local $, = ', '; my @sorted_args = sort @ARGV; print @sorted_args; } print "\nBack to normal: ", @ARGV, "\n"; { local $" = '-'; my @sorted_args = sort @ARGV; print "@sorted_args"; } print "\nBack to normal: @ARGV\n"; =OUTPUT % ./sortedargs.pl c a b a, b, c Back to normal: cab a-b-c Back to normal: c a b

-Blake