Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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


Comment on Re: Replace strings in multiple files
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2014-09-16 11:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (13 votes), past polls