In article <[EMAIL PROTECTED]>, Sudarshan Raghavan 
wrote:

> Ling F. Zhang wrote:
> 
>>say I have array:
>>@a=["I","LOVE","PERL"]
[...]
> This will do what you want
> my $arr_to_str = "@a";
[...]

Wow!

I tried a couple more variations - and wonder why the last one doesn't 
evaluate a count of the slice...

#!/usr/bin/perl
use warnings;
use strict;

my @array = qw/apples oranges pears/;

my $string = "@array";
print "$string\n";
# prints "apples oranges pears"

$string = join '', @array;
print "$string\n";
# prints "applesorangespears"

$string = "@array[0..1]";
print "$string\n";
# prints "apples oranges"

$string = @array[0..1];
print "$string\n";
# prints "oranges" (why not "2"?)

-K
-- 
Kevin Pfeiffer
International University Bremen

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to