paragkalra has asked for the wisdom of the Perl Monks concerning the following question:
Hello All,
When we print array elements to a file (please refer the code below), by default space character is placed as the delimiter between the array elements.
Is there a direct way/variable where we can specify the delimiter to separate the array elements.
#!/usr/bin/perl use strict; use warnings; open my $fh, '>', 'array.out' or die "Could not create the file.\n"; my @array = ('one','two','three','four','five'); print $fh "@array"; close $fh;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Printing Array to a file
by Corion (Patriarch) on Jan 27, 2010 at 08:00 UTC | |
|
Re: Printing Array to a file
by chromatic (Archbishop) on Jan 27, 2010 at 08:02 UTC | |
|
Re: Printing Array to a file
by Ratazong (Monsignor) on Jan 27, 2010 at 08:00 UTC | |
|
Re: Printing Array to a file
by ambrus (Abbot) on Jan 27, 2010 at 09:46 UTC | |
by johngg (Canon) on Jan 27, 2010 at 11:15 UTC | |
|
Re: Printing Array to a file
by paragkalra (Scribe) on Jan 27, 2010 at 08:16 UTC |