On Fri, Dec 10, 2010 at 6:43 PM, Jay Austad <austad at signal15.com> wrote: > Hmm, here's what I have, and I'm getting a "use of unitialized value" error for s1 and s2: > > #!/usr/bin/perl -w > while (my $line = <STDIN>) { > ($s1,$s2) = $line =~ m/.*object-group (\S*).*object-group (\S*)/; > if ( $s1 eq $s2 ) { > print $line; > } > } Sure, you're still comparing $s1 to $s2 even if the match fails. You can ignore the warning, or only compare if the match hits: if ($line =~ /.*object-group (\S*).*object-group (\S*)/) { print $line if $1 eq $2; } You might also want to use captures like (\S+) to ensure some string is there.