package Foo; use strict; sub bar { my $File = UNIVERSAL::isa( $_[0], 'IO::File' ) ? shift : return undef; # Do something to file } 1;