Skip to content

Commit 1d3137c

Browse files
use more efficient expr form of map, grep when possible
1 parent 5c9b704 commit 1d3137c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/File/Temp.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ sub _is_verysafe {
804804

805805
sub _can_unlink_opened_file {
806806

807-
if (grep { $^O eq $_ } qw/MSWin32 os2 VMS dos MacOS haiku/) {
807+
if (grep $^O eq $_, qw/MSWin32 os2 VMS dos MacOS haiku/) {
808808
return 0;
809809
} else {
810810
return 1;
@@ -1004,7 +1004,7 @@ sub _can_do_level {
10041004
sub _parse_args {
10051005
my $leading_template = (scalar(@_) % 2 == 1 ? shift(@_) : '' );
10061006
my %args = @_;
1007-
%args = map { uc($_), $args{$_} } keys %args;
1007+
%args = map +(uc($_) => $args{$_}), keys %args;
10081008

10091009
# template (store it in an array so that it will
10101010
# disappear from the arg list of tempfile)

t/rmtree.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ sub dircontent {
3535
my $tempdirstr = shift;
3636
my $str = "Contents of $dir (should not contain \"$tempdirstr\"):\n";
3737
opendir(my $DH, $dir) or die "opendir failed; $!";
38-
my @contents = grep { $_ !~ /^\.+/; } readdir($DH);
38+
my @contents = grep $_ !~ /^\.+/, readdir($DH);
3939
closedir($DH);
4040
for my $ls (@contents) {
4141
$str .= " $ls\n";

0 commit comments

Comments
 (0)