# grab the first two non-whitespace items, separated by whitespace. my ($date, $time) = $s =~ /(\S+)\s+(\S+)/; # grab the last two portions of the disk name, # which is immediately followed by the first ^ in the file. my ($disk) = $s =~ /\\(\w+\\\w+)\^/; # grab the user name, which is the string before the last ^, # which in turn is followed by some white space and the end of the string. # You can take out the \s+ if the space between the ^ and end of string was an artifact of your post. my ($user) = $s =~ /(\w+)\^\s+$/;