#! /usr/bin/perl use strict; use warnings; use Data::Dumper; use File::Glob qw/:glob/; # There lives a file "passwords.dat" in the current directory.... # This matches the whole filename. OK my $pat1 = "passwords.dat"; print "\nPATT $pat1\n"; print "PRE ERR: ", Dumper($!); my @list = bsd_glob($pat1, GLOB_ERR); print Dumper(\@list); print "POST ERR: ", Dumper($!); print "\n"; # This file is not there so it doesn't match and afterwards $! ist # set. OK my $pat2 = "this_will_miss_in_globbing"; print "\nPATT $pat2\n"; print "PRE ERR: ", Dumper($!); @list = bsd_glob($pat2, GLOB_ERR); print Dumper(\@list); print "POST ERR: ", Dumper($!); print "\n"; # This should match again since it is just the same as the first match # but *afterwards $! ist still set*!!?? my $pat3 = "passwords.dat"; print "\nPATT $pat3\n"; print "PRE ERR: ", Dumper($!); @list = bsd_glob($pat3, GLOB_ERR); print Dumper(\@list); print "POST ERR: ", Dumper($!); print "\n"; # This resets $! back to normal which is just fine my $pat4 = "*.dat"; print "\nPATT $pat4\n"; print "PRE ERR: ", Dumper($!); @list = bsd_glob($pat4, GLOB_ERR); print Dumper(\@list); print "POST ERR: ", Dumper($!); print "\n";