$PipeCounter = y/|/|/; #### #!/usr/bin/env perl use strict; use warnings; while () { print "Line $. has ", y/|/|/, "\n"; } __DATA__ ||||| !|@|#|$|%| |1|2|3|4| |q|w|e|r|t y|u|i|o|p A|S|D|F|G|H Z|X|C|V|B|N| #### Line 1 has 0 Line 2 has 5 Line 3 has 5 Line 4 has 5 Line 5 has 5 Line 6 has 4 Line 7 has 5 Line 8 has 6