Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Replace strings in multiple files

by zentara (Archbishop)
on Nov 13, 2012 at 13:18 UTC ( [id://1003608]=note: print w/replies, xml ) Need Help??


in reply to Replace strings in multiple files

Something like this basic File::Find code should show you the right technique. Where I do the print, open and process the file.
#!/usr/bin/perl use warnings; use strict; use File::Find; use File::Basename; my $dir = '.'; my @files; my @exts = qw(wbmp wmf jpeg jpe jpg ani bmp gif ico cur pcx png pnm pb +m pgm ppm ras tga targa xbm tiff tif xpm svg svgz); find( sub { my $file = $File::Find::name; my ($name, $path, $extension) = fileparse($file,'\..*'); substr $extension, 0, 1, ''; #remove leading . if( grep {$_ eq $extension} @exts ){ print "file - $file ext = $extension\n" ; } }, $dir ); #print "@files\n";

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-04-23 19:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found