my @in; while (<>) { push @in, $1 if /(\$[A-Za-z_]\w*)/; }