Hello
AmberThai and welcome to the monastery!
If you are 'super new' i have some suggstion:
- die unless $ARGV[0];die unless $ARGV[1]; make you sure to have what you 'll need after
- open my $input, '<', $ARGV[0]; should always be open my $input, '<', $ARGV[0] or die "Unable to open [$ARGV[0]]";
- move my $substring = 'clothes.*?mall'; outside of the loop: you are reinstatiate the variable each iteration
- my $substring = 'clothes.*?mall'; what is? you perhaps want a regex? a compiled one? see qr in quote like operator
- what is read-only{$substring}? come from this module?
- you probably want someting like print $output $sentence if $sentence=~/$compiled_regex_with_qr_operator/ (update removed the comma in $output , $sentence 'cause the first is a file handle. as spotted by Athanasius, thanks)
HtH
L*
UPDATE:
perlrun has many gifts ready to you! your achievement is pretty easy with a Perl onliner and a redirection (shell redirection)
#cat cat.txt
meow
pretty woman
arf
#perl -lne "print if /ty wo/" cat.txt > cat.out.log
#cat cat.out.log
pretty woman
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.