#the next 2 line have been assigned earler in the program from reading in the config file $filter = "user (.*) has (logged on)"; $output_string = "user $1 has accessed the system and is $2"; #this line has been read in from a log file $log_string = "user bob has logged on"; # need to search the log string and format output string replacing $1 & $2 $output_string =~s/filter//g; $output_string =~s/(\$\w+)/$1/eeg; print "$output_string\n";