http://www.perlmonks.org?node_id=1016509


in reply to Re^2: Pattern matching
in thread Pattern matching

Thanks for help and input. below code works fine:
my $file = "t.txt"; open(FH,$file) || die "can't open file \n"; while (<FH>) { chomp; my $line = $_; $line =~ s/\"(.*?)\"/replace($1)/ge; $line =~ s/\,/~/g; $line =~ s/\;/,/g; print "$line \n"; } close FH; sub replace { my ($str) = @_; $str =~ s/\,/\;/g; return $str; }