abhikalrt53 has asked for the wisdom of the Perl Monks concerning the following question:
Monks!!!
Why this perfect (tested in ubuntu linux) script
perl -ane '$s = ""; foreach (@F) { /(\d+)-(\d+)/ and $2 - $1 >= 30 and $s .= " $1-$2" } print "$F[0]$s\n" if $s' input.txt
is not running on windows machine?
it shows:
C:\Users\Desktop\x\New folder>perl -ane '$s = ""; Can't find string terminator "'" anywhere before EOF at -e line 1. C:\Users\Desktop\x\New folder>foreach (@F) { /(\d+)-(\d+)/ and $2 - $1 + >= 30 and $s .= " $1-$2" } 'foreach' is not recognized as an internal or external command, operable program or batch file.
I have also tried to wrapped in in one line as:
perl -ane '$s = ""; foreach (@F) { /(\d+)-(\d+)/ and $2 - $1 >= 30 and + $s .= " $1-$2" } print "$F[0]$s\n" if $s' input.txt
still this :-( :
Can't find string terminator "'" anywhere before EOF at -e line 1.
Changing ' to " wont change the error.
Some wisdom please.
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why this script is not running on windows?
by Corion (Patriarch) on Nov 01, 2016 at 10:24 UTC | |
by abhikalrt53 (Novice) on Nov 01, 2016 at 10:29 UTC | |
|
Re: Why this script is not running on windows?
by haukex (Archbishop) on Nov 01, 2016 at 10:35 UTC | |
by abhikalrt53 (Novice) on Nov 01, 2016 at 11:01 UTC | |
by haukex (Archbishop) on Nov 01, 2016 at 11:12 UTC | |
by abhikalrt53 (Novice) on Nov 01, 2016 at 11:22 UTC |