Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Pattern matching

by perlCrazy (Monk)
on Feb 01, 2013 at 10:35 UTC ( #1016509=note: print w/ replies, xml ) Need Help??


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; }


Comment on Re^3: Pattern matching
Download Code
Re^4: Pattern matching
by tmharish (Friar) on Feb 01, 2013 at 10:50 UTC
    perlCrazy like choroba has mentioned its easy to miss certain cases - Best to use a module that's been put through its paces on all kinds of different data.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1016509]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2015-07-02 01:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (25 votes), past polls