perldoc -f glob explains this behavior
In list context, returns a (possibly empty) list of filename expansions on the value of EXPR such as the standard Unix shell /bin/csh would do. In scalar context, glob iterates through such filename expansions, returning undef when the list is exhausted.
So you are using iterator version which should be used with while
to loop over it (all the way until it gets exhausted).
As you clearly want to get only first value using list context you can,
my ($file) = <*.ext>;