Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

furry_marmot's scratchpad

by furry_marmot (Pilgrim)
on Feb 24, 2011 at 20:34 UTC ( #890054=scratchpad: print w/ replies, xml ) Need Help??

#!/usr/bin/perl use warnings; use strict; my @files = </path_to_nine_files_prefixed_by_rawfile/rawfile*>; my $filecount = $#files - 1; #relative to 0 open( MASTER, "/path_to_starting_file/rawfile" ); #Open filehandles and store to array my $fh = 'A'; my @fhandles; for (0..$filecount) { open $fh, $files[$_] or die $!; push @fhandles, $fh++; #'A', 'B', 'C', etc. } #process the first line of master and then get the first line of the o +ther #files, since files are all same length... while (<MASTER>) { $_ =~ s/^\s+//; $_ =~ s/\s+$//; print "$_,"; #Read each file, print newline after last. foreach my $fh (@fhandles) { my $required_line = <$fh>; chomp $required_line; $required_line =~ s/^\s+//; $required_line =~ s/\s+$//; print "$required_line,"; } print "\n"; } #end while
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2015-07-28 06:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (252 votes), past polls