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


in reply to Problematic UploadFile() method in CGI.pm

You need add a parenthesis to capture the hash reference, otherwise you will keep getting undef:

print h2('File MIME type'), (uploadInfo($file))->{'Content-Type'};

Replies are listed 'Best First'.
Re^2: Problematic UploadFile() method in CGI.pm
by Errto (Vicar) on May 21, 2006 at 17:02 UTC
    I don't believe that's correct. See this small example:
    my $hash = { a => 'b' }; sub foo { print $_[0], "\n"; return $hash; } print foo('abcd')->{a};
    No parens required to use the arrow notation with a subroutine return value.