in reply to Re: Removing data from a string with Regex
in thread Removing data from a string with Regex
toopen FILE, $filename || die $!;
or if you really want to use ||open FILE, $filename or die $!;
also it wouldn't hurt to be more verbose:open(FILE,$filename) || die $!;
UPDATE: The usage of the \g modifier is for multiple matching,substituting,etc. you don't need it if you know what you are searching for only occurs once as is the case:die "Could not open $filename: $!\n";
It wouldn't hurt to also have a look at perlop$str ='abcd'; $str =~s/a//g; # \g unnecessary ## $str = 'abacad'; $str =~s/a//g; # more appropriate
|
|---|