package Foo; sub whence { my $fp = shift; $fp =~ s=::=/=g; $fp .= '.pm'; $INC{$fp} } package main; use warnings; print Foo::whence('warnings'),$/;