Perl でどこで呼び出されたかを返す caller

open FILE, 'hoge' or error("can't open file\n");

sub error {
    print @_[0];
    my @call = caller;
    print "Package name: $call[0]\n";
    print "File name:    $call[1]\n";
    print "Line no:      $call[2]\n";
}


- エラー時の出力

can't open file
Package name: main
File name:    ./test.pl
Line no:      5