in reply to Re^3: Search and Copy
in thread Search and Copy
Again, please use <code> tags and read How do I post a question effectively?
I have found strict to be very helpful to identifying and avoiding bugs in my code -- see Use strict warnings and diagnostics or die. If I were going to write your posted code, it might look more like:
use strict; use warnings; open (my $out, ">", "Results.txt") or die ("Could not open file Result +s.txt; $!"); open (my $in, "<", "Textfile.txt") or die ("Can not open input file: $ +!"); local $/; while (<$in>) { if (/(web site.{250})/i) { print $out $1; } }
Changes that I made include:
You may consider going to http://learn.perl.org to gather some learning resources before trying to run too far.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|