jalopez453 has asked for the wisdom of the Perl Monks concerning the following question:
Hello everyone, I am looking for a little help on my code here. I want to copy the lines that have the letter M in the first column but not sure what I am doing wrong or what is missing. I am very new to perl, so I apologize for this very basic request. Thank you in advance for the help
use strict; my $find = 'M'; open (NEW, ">", "output.txt" ) or die "could not open:$!"; open (FILE, "<", "Report.txt") or die "could not open:$!"; while (<FILE>) { print NEW if (/$find/); } close (FILE); close (NEW);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: copy line with character
by stevieb (Canon) on Nov 23, 2015 at 18:41 UTC | |
by jalopez453 (Acolyte) on Nov 23, 2015 at 18:54 UTC | |
by jalopez453 (Acolyte) on Nov 23, 2015 at 19:24 UTC | |
by stevieb (Canon) on Nov 23, 2015 at 19:37 UTC | |
by jalopez453 (Acolyte) on Nov 23, 2015 at 20:24 UTC | |
| |
by BillKSmith (Monsignor) on Nov 23, 2015 at 20:44 UTC | |
by jalopez453 (Acolyte) on Nov 23, 2015 at 20:55 UTC | |
|