Help for this page
# Use a regex object so it's compiled only once $exp = qr|^DMSC0022\s+\S+\s+(\w+)$|; ... # to generate. This is still silly. eval "print \"$str\""; }
$exp = qr/\w+$/; $str = "Logfile_Connection_Lost Hostname:"; ... ($hostname) = $input =~ m/$exp/g; print "$str$hostname" if defined $hostname;