OK, I'm a real newbie, but even I am ashamed to be asking this.
I want to search for a vertical mark ( | ) and replace it with
something else (h). That's all - nothing fancy. What am I doing
wrong here:
use strict;
use warnings;
my $listelem = "52101.txt";
#Open file in listelem if it exists
if (-e $listelem) {
open (HANDLE, $listelem);
}
else {
print "$listelem does not exist.\n";
system('pause');
}
#Grab main file contents
chomp (my @filecontents = <HANDLE>);
while (<HANDLE>) {
my $filecontents =~ s/\|/h/;
}
__END__
It's probably in the my $filecontents =~ s/\|/h/;
statement. I'm guessing the $filecontents is not the
correct thing to use. Or maybe I have to open the
file with append (>>). I assume I have to
escape the "|" in the search expression above.
I've tried various combinations of the g m and s
modifiers for the search, but none work.
I know I don't have to suck the entire file contents
into @filecontents, but I do want to do that for other
reasons.
The file.txt file contains:
1.13589
30
0.0
40
0.065
1
FSC|M NO.
100
AcDthYext
0
TET
5
DPUYC5D
330
DDYED26
100
I get the digest version of this list, so if you need immediate
response, you might want to cc me directly
mailto:[EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]