I think you are going to have explain what it is you are trying to do here, because it isn't entirely clear from your code.
If all you want to do is edit all of the files in the directory /perl/bin/dir then you can just do:
perl -pi.bak 's/<meta name="/<meta name="area./gi' perl/bin/dir/*
In the code that you have the glob() will only return one value (ie./perl/bin/dir) and then you appear to get confused about what opendir does.
If you want to do this in longer code rather than a one-liner then you might try something like:
#!/usr/bin/perl -w
use strict;
use Fcntl qw(:seek);
my $dir = './dir';
opendir(DIR,$dir) || die "Can't open $dir - $!\n";
my @files = map { "$dir/$_" } grep !/^\.{1,2}$/, readdir(DIR);
closedir DIR;
foreach my $file (@files)
{
open(FILE, "+<$file") || die "Can't open $file - $!\n";
my $contents = do { local $/; <FILE> };
$contents =~ s/<meta name="/<meta name="area./gis;
truncate(FILE,0) || die "truncate - $file : $!\n";;
seek( FILE,SEEK_SET,0) || die "seek - $file : $!\n";
print FILE $contents;
close FILE;
}
/J\ |