luckysing has asked for the wisdom of the Perl Monks concerning the following question:
i have multiple files containing data as name value pairs which are both numbers.
the data is as follows: name|rollno some1|1 some2|2 some3|3
the problem is i am getting repeated set of values from different text files like name:rollno some1:1 some2:2 some3:3 name:rollno some1:1 some2:2 some3:3 Since ssome1 some2 some3 is common is in everytext file iam making it a column name.I want to read a block of values(1,2,3) from each file and only read the column names once. the code i have tried so far is listed below which splits the data into
my @files=<*.text>;#scans for .txt extensn in the curent dir local @_=@files; foreach my $file(<>) { chomp($file); ($name[$i],$value[$i])=split(",",$file); $i++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: reading textfiles into 1 whole file
by jwkrahn (Abbot) on Jul 13, 2010 at 01:00 UTC | |
by luckysing (Novice) on Jul 13, 2010 at 07:53 UTC | |
|
Re: reading textfiles into 1 whole file
by graff (Chancellor) on Jul 13, 2010 at 08:23 UTC | |
by luckysing (Novice) on Jul 13, 2010 at 19:58 UTC |