[Israel.pm] Double Array

Levenglick Dov-RM07994 DovL at freescale.com
Wed Feb 9 00:21:48 PST 2005


while(<FILE>) {
   $filetext .= $_;
}

This can be rewritten as:
local $/ = undef;
$filetest = <FILE>;

 
Best Regards,
Dov Levenglick
The information contained in this email is classified as:
[ ] General Business Information
[ ] Freescale Internal Use Only
[ ] Freescale Confidential Propriety
[x] Personal Memorandum
 


-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On Behalf Of Offer Kaye
Sent: Wednesday, February 09, 2005 9:56 AM
To: Perl in Israel
Subject: Re: [Israel.pm] Double Array


Shlomo Yona gave you one possible solution that will work for you.
Here is another:
################ code ##############
use strict;
use warnings;
my $filename = "data.txt";
open(FILE, $filename) or die "Cannot open $filename for reading: $!\n";
my $filetext;
while(<FILE>) {
   $filetext .= $_;
}
close(FILE) or die "Cannot close $filename after reading: $!\n";
my @lines = map { [ split(/;;;;/, $_) ] } split (/\n/, $filetext);
################ end code ##############

_______________________________________________
Perl mailing list
Perl at perl.org.il
http://perl.org.il/mailman/listinfo/perl



More information about the Perl mailing list