AmberThai has asked for the wisdom of the Perl Monks concerning the following question:
Hello friends, I am new to perl programming and I would like some help about reading files.
I wish to know how can you can do something like
open my $input, '<', $ARGV[0]; open my $output,'>', $ARGV[1]; while (my $sentence = <$input>) { my $substring = 'clothes.*?mall'; $sentence =~ read-only{$substring}; print $output , $sentence; }
and read from a text file that contains something like :"I used to buy clothes from the mall because they are cheap" only the values between the words "clothes" and "mall" so I could do certain operations with them and after I do all the operations with the values between the 2 keywords I want to output the file with all the values("I used to buy clothes' from the 'mall because they are cheap") the words between ' ' represent the words " from the " after the operations were done on them.
P.S. Sorry if it is a stupid question or a stupid example but I am super new in all this and a terrible question asker.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading from files
by choroba (Cardinal) on Jan 18, 2016 at 09:42 UTC | |
by AmberThai (Initiate) on Jan 18, 2016 at 10:34 UTC | |
by choroba (Cardinal) on Jan 18, 2016 at 13:03 UTC | |
|
Re: Reading from files
by Discipulus (Canon) on Jan 18, 2016 at 09:38 UTC |