Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Replace strings in multiple files

by zentara (Archbishop)
on Nov 13, 2012 at 13:18 UTC ( #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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1003608]
[choroba]: Here you're lucky if they give you 5 months
Discipulus worst is an endless concept..

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2018-05-23 21:09 GMT
Find Nodes?
    Voting Booth?