in reply to Can't use an undefined value as a symbol reference

Well, for starters, fixing the obvious mistakes:

use strict; our $it; my @fils; foreach my $line (@fils) { if ($line =~ /aa bb cc/) { $it = 4; # do something } if ($it == "4") { # more stuff } }

Other than that, I have no clue what you are trying to do.

HTH,

planetscape