http://qs321.pair.com?node_id=1165237


in reply to Re^2: Odd number of elements in anonymous hash
in thread Odd number of elements in anonymous hash

I didn't notice it was a string, thanks. So it could be done like this, though toolic's answer is cleaner.
my $attached = $code ? { attach_path => $file_name, attach_filename => + $file_name, attach_type => 'application/txt' } : {};