$filesize=-s _ if (-e $foo); #### $filesize=File::size($foo) if File::exists($foo);