sub addSecondary($$)
{
my ($email, $secondary) = @_;
open (MYFILE, 'registration.dat');
while (<MYFILE>)
{
chomp;
my $line = $_;
if($line =~ /$email/)
{
$line =~ s/nodata/$secondary/gi;
}
}
close (MYFILE);
}
I am trying to find strings which contain $email and replace the nodata part with $secondary. This code works but isn't updating the file. The data is still the same. What am I missing?

New Topic/Question
Reply



MultiQuote





|