Hi,

You may use the $, variable like this:

$, = "\n";
print (1,2,3,4);

The output will be:
1
2
3
4

Regards,
Andras


On Mon, 26 Feb 2007 12:27:56 +0100, Igor Sutton Lopes <[EMAIL PROTECTED]> wrote:

Hi,

On 2007/02/26, at 11:08, [EMAIL PROTECTED] wrote:


The above code does not seem to work for me.
I get an error saying $" is unrecognised.
do i need to include anything ?

Actually, I'm using Perl 5.8.8. I don't know if 5.6 or lower has that
variable. Actually, it does. If you are on unix you can try this:

$ perl -e '@a = qw(1 2 3 4); { local $" = "\n"; print "@a" }'

The output will be like this:

1
2
3
4

 From "perldoc perlvar":
        $LIST_SEPARATOR
        $"      This is like $, except that it applies to array and
slice val-
                ues interpolated into a double-quoted string (or
similar inter-
                preted string).  Default is a space.  (Mnemonic:
obvious, I
                think.)

HTH!

--
Igor Sutton
[EMAIL PROTECTED]






--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to