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

Hello respectable monks I am here to ask a question about files, sorry if my question is noobish but I am new to perl programming

file1:"!?abcdesfjsashccm,iosa/hitler/genocide/notok.cadshuiahdoaejoed/mom/dad/family.cauifhaiufaiu" and
file 2:"
val0=/hitler/genocide/notok.c
val1=/mom/dad/family.c
"
I want my program to read from file2 each value and ignore it from file 1,so if I do any operations on file 1 those parts of the text files to be ignored and I can work with the rest of the file.

So if I read the file1 I want it to read "!?abcdesfjsashccm,iosaadshuiahdoaejoedauifhaiufaiu"

I am sorry to ask from you for this but believe me I really am trying to understand perl as much as I can and sadly I have no time to read everything because I must finish my project soon...

Replies are listed 'Best First'.
Re: Ignore given character from file
by hippo (Archbishop) on Jan 13, 2016 at 11:29 UTC

      ok you are right it was easy,but may I ask another question? if you have

      my $sentence = 'The quick brown fox jumped over the lazy dog'; my $substring = 'quick.*?fox'; $sentence =~ s{$substring}{big bad wolf};

      you get an output of 'The big bad wolf jumped over the lazy dog',but how can I tell him to ignore even "The" from the sentence but not by using :

      my $sentence = 'The quick brown fox jumped over the lazy dog'; my $substring = 'The.*?fox'; $sentence =~ s{$substring}{big bad wolf};

      but by telling him to ignore 4 characters before "quick"

        Change your regex to include those four characters:

        my $substring = '....quick.*?fox';