in reply to $_[0] fails for file handle?

You already have your answer, but here is a method to finding that answer.

Tip #6 from the Basic debugging checklist: Check to see if your code is what you thought it was: B::Deparse

use warnings; use strict 'refs'; open my $FH, '/tmp/test.txt'; while (my $Line = GetLine($FH)) { do { print "$Line" }; } use File::Glob (); sub GetLine { use warnings; use strict 'refs'; my $line = glob($_[0]); return $line; }