use strict; use Mail::IMAPClient; use Data::Dumper; sub test_quote { print "Parameters: " . Dumper \@_; my @quoted= Mail::IMAPClient->_quote_search(@_); print "Result : " . Dumper \@quoted; }; test_quote( q(SUBJECT "SUBJECT \"test email \"abc123\" approved\")); test_quote( SUBJECT => q(test email "abc123" approved) ); __END__ Parameters: $VAR1 = [ 'SUBJECT "SUBJECT \\"test email \\"abc123\\" approved\\"' ]; Result : $VAR1 = [ 'SUBJECT "SUBJECT \\"test email \\"abc123\\" approved\\"' ]; Parameters: $VAR1 = [ 'SUBJECT', 'test email "abc123" approved' ]; Result : $VAR1 = [ 'SUBJECT', '{28} test email "abc123" approved' ];