Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: compare and merge files

by reneeb (Chaplain)
on Feb 05, 2006 at 07:50 UTC ( [id://528045]=note: print w/replies, xml ) Need Help??


in reply to Re: compare and merge files
in thread compare and merge files

May be this is helpful:
use strict; use warnings; use Data::Dumper; my @paths = qw( This/is/the/full/path/file.abc.part-1.txt This/is/the/full/path/file.abc.part-2.txt This/is/the/full/path/file.abc.part-3.txt This/is/the/full/path/file.def.part-1.txt This/is/the/full/path/file.def.part-2.txt This/is/the/full/path/file.ghi.part-1.txt This/is/the/full/path/file.jkl.part-2.txt This/is/the/full/path/file.mno.part-5.txt ); my %combo; foreach my $pathfile ( @paths ){ if( $pathfile =~ m/^.+file\.\w+?\.part-\d+\.txt$/ ){ (my $key = $pathfile) =~ s/part-\d+\.txt$/MERGED.txt/; push( @{ $combo{$key} }, $pathfile ); } else{ warn "$pathfile does not match expected format"; } } print Dumper(\%combo);

Log In?
Username:
Password:

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

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

    No recent polls found