'ab' =~ /a(z?)b/ # Returns ''. 'ab' =~ /a(z)?b/ # Returns undef. #### my @fizzbin = ( $string =~ m{ (\w+)\n # Grab the title What:\s+([^\n]+)\n # Grab the what Date\sadded:\s+([^\(^\n]+) # Date added (\([^\n]+\))?\n # Optional source Data:\s+([^\n]+)\n # Grab the data }xmgs); #### while ( my ($title, $what, $date, $source, $data) = $string =~ m{ (\w+)\n # Grab the title What:\s+([^\n]+)\n # Grab the what Date\sadded:\s+([^\(^\n]+) # Date added (\([^\n]+\))?\n # Optional source Data:\s+([^\n]+)\n # Grab the data }xmgs ) { $source = '' if not defined $source; # Use default ''. ... }