[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] Burned be a one-liner



-laugh-

I was wondering why my report was wrong. 

Don't make this mistake. :)

j


$ cat j
A B
A B
XXX
B A
B A
$ cat j | perl -ne '/(\w) (\w)/; print "$1 $2\n";' | sort | uniq -c
      3 A B
      2 B A



----

Question:

There aren't 3 "A B" strings in my file. Why does my one-liner lie to
me?




Answer:

Because $1 and $2 are not cleared when the regex doesn't match on the
XXX line.


doh!