in reply to [untitled node, ID 192753]

One thing that might speed up your code is to use a compiled regex:

my $search = qr/--\s*USER\s+\d+\s*-\s*(\w+)/; foreach $line (@site) { next unless ( $line =~ $search ); $user = $1; }