-
-
Save hirose31/bfe123d4e763627bcca739c447e8bf65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use 5.010_000; | |
use Data::Dumper; | |
# https://perldoc.jp/docs/perl/5.26.1/perlvar.pod | |
# <FH>, readline, readdir, each が単独で while テストで テストされた場合の、次の値や入力レコードを入れるデフォルトの場所。 while テスト以外ではこれは起こりません。 | |
sub foo { | |
my %h = ( foo => 1 ); | |
while (each %h) {} | |
# open my $fh, '<', '/etc/passwd' or die $!; | |
# while (<$fh>) {} | |
# close $fh; | |
return 1; | |
} | |
my $aaa = ['31']; | |
@$aaa = grep { foo() } @$aaa; | |
print Dumper $aaa; # => [ undef ] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment