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

torres09 has asked for the wisdom of the Perl Monks concerning the following question:

Hey

I am working with text file and it looks like "5300;; val ;; ;;6;; 1;; 1;; -50;; 50;; ;; ;; ;; ;; ;; ;;"

and I just want to replace ;; with comma , how can i do it

Replies are listed 'Best First'.
Re: find and replace in perl
by prashantktyagi (Scribe) on Jun 24, 2013 at 05:46 UTC
    $string =~ s/$pattern/$replace/g
      hey

      can't we do the find and replace operation via perl on the entire text file , without taking it into an array

      like say find and replace on a file handler . sorry I am new to perl , so I don't have a lot of command on it

        perl -pi.bak -e 's/pattern/replace/g' filename.txt

        Dave

        sorry I am new to perl

        :) I read perlintro every day, and I'm very old to perl :)