use strict; use warnings; while () { print "$1\n" if $_ =~ /(!=|<=|>=|==)/; } __DATA__ $this <= $that $this lt $that $this >= $that $this gt $that $this != $that $this ne $that $this == $that $this eq $that