[Chicago-talk] Where'd I come from?

Mike Fragassi frag at ripco.com
Fri Jan 26 12:15:40 PST 2007

> That is, sub name and main script, but not the 'require'-ed script name.
> Is there a way to get that?

You can use the tokens __FILE__ and __LINE__:

   sub foo {
      print "In file " . __FILE__ .
          ", at line #" . __LINE__ . ".\n";

-- Mike F.

More information about the Chicago-talk mailing list