Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: making 3 files into one

by Anonymous Monk
on Feb 18, 2009 at 08:49 UTC ( [id://744694]=note: print w/replies, xml ) Need Help??


in reply to making 3 files into one

hi friend, Try out this one...
opendir(DIR,'.') or die $!; @read=readdir(DIR); close(DIR); foreach(@read){ if($_ =~/^f\d.txt$/){ push(@read1,$_); } } @read2=sort(@read1); foreach (@read2){ open(FILE,$_) or die $!; push(@file,<FILE>); close(FILE); push(@file,"LINE\n"); } $string=join('',@file); $string=~s/\n/#/g; ($val1,$val2,$val3)=split('LINE#',$string); @val1=split('#',$val1); @val2=split('#',$val2); @val3=split('#',$val3); foreach $i(0 .. scalar @val1){ print "$val1[$i]\t$val2[$i]\t$val3[$i]\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://744694]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-25 05:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found