Charlie Farinella wrote:
>
> I have a string of text that I want to split on the tabs:
>
> while (<INFILE>) {
> my @array = split(/\t/, $_);
>
> ...manipulate them a little, and print them back out like so:
>
> print "$array[0],$array[1],$array[2]"; etc.
> }
>
> I normally just print them as above, but I'm thinking there must be a
> better way.
> What's the most efficient way to print them all out?
Just
print "@array\n";
will output the elements separated with spaces by default. To change the
separator to a comma you can write
local $" = ',';
print "@array\n";
HTH,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/