perl-5.34.0
$ARG
$_

The default input and pattern-searching space. The following pairs are equivalent:

��������í�˨����勐�ュ����������帥�若�恰��膣≪�勉�鴻����若�鴻�� 篁ヤ����� 2��ゃ�壠����ゃ�с��:

    while (<>) {...}    # equivalent only in while!
    while (defined($_ = <>)) {...}
    while (<>) {...}    # while ��勌賢��с�勉�睡��箴�!
    while (defined($_ = <>)) {...}

    /^Subject:/
    $_ =~ /^Subject:/

    tr/a-z/A-Z/
    $_ =~ tr/a-z/A-Z/

    chomp
    chomp($_)

Here are the places where Perl will assume $_ even if you don't use it:

�����ŝ�����篏帥����������ŝ����⓾�� Perl ��� $_ ���篁勐����������翫�������������ゃ����������障��:

  • The following functions use $_ as a default argument:

    篁ヤ����勰�∽�違�� $_ �����������í�˨��綣���違�������☖戎�����障��:

    abs, alarm, chomp, chop, chr, chroot, cos, defined, eval, evalbytes, exp, fc, glob, hex, int, lc, lcfirst, length, log, lstat, mkdir, oct, ord, pos, print, printf, quotemeta, readlink, readpipe, ref, require, reverse (in scalar context only), rmdir, say, sin, split (for its second argument), sqrt, stat, study, uc, ucfirst, unlink, unpack.

    abs, alarm, chomp, chop, chr, chroot, cos, defined, eval, evalbytes, exp, fc, glob, hex, int, lc, lcfirst, length, log, lstat, mkdir, oct, ord, pos, print, printf, quotemeta, readlink, readpipe, ref, require, reverse (��鴻�˨�í�潟�潟����㏍�鴻����勉��), rmdir, say, sin, split (��� 2 ��ɾ�勉�勐�����), sqrt, stat, study, uc, ucfirst, unlink, unpack

  • All file tests (-f, -d) except for -t, which defaults to STDIN. See "-X" in perlfunc

    ��������í�˨����� STDIN ��с����� -t �����ゃ�������⓾�勉����<�ゃ�˨����鴻��(-f, -d)��� "-X" in perlfunc ��������с����⓾��������������

  • The pattern matching operations m//, s/// and tr/// (aka y///) when used without an =~ operator.

    =~ 羲�膊�絖���ŝ����х�������������������帥�若�潟��������羲�膊� m//, s///, tr/// (��障����勐����� y///)���

  • The default iterator variable in a foreach loop if no other variable is supplied.

    foreach ��˨�若����с�勌����勐����違��茖���������ŝ����c����翫����勉�������í�˨����勛弘���菴����紊���違��

  • The implicit iterator variable in the grep() and map() functions.

    grep() ��∽�違�� map() ��∽�違�勖��藥���勛弘���菴����紊���違��

  • The implicit variable of given().

    given() ��勖��藥���勐����違��

  • The default place to put the next value or input record when a <FH>, readline, readdir or each operation's result is tested by itself as the sole criterion of a while test. Outside a while test, this will not happen.

    <FH>, readline, readdir, each ��������㋘�� while �����鴻���� �����鴻�������������翫����勉��罨<�勐�ゃ����ュ����㋘�潟�若�������ャ�������������í�˨����勐�贋����� while �����鴻��篁ュ����с�壔�������虁儀��������障��������

$_ is a global variable.

$_ ��壔�違�㏍�若�����紊���違�с�����

However, between perl v5.10.0 and v5.24.0, it could be used lexically by writing my $_. Making $_ refer to the global $_ in the same scope was then possible with our $_. This experimental feature was removed and is now a fatal error, but you may encounter it in older code.

������������perl v5.10.0 ������ v5.24.0 ��勰����� my $_ �����吾����������с����������㋘�㏍�激�˨�˨�˩戎��������������堺�ャ�障�������� ��������鴻�潟�若����� $_ �����違�㏍�若����˨�� $_ ��������с�������勉� our $_ ��у櫝�純�˨�ŝ�c�⓾����障�������� �����勐��薑����罘���純�壠����ゃ�������☖����с�虁�翫�順�������í�若�с�������� �𡉴����潟�若����ц�������������������ャ����障��������

Mnemonic: underline is understood in certain operations.

荐���倶��: 筝�膩���壔��������篏����荀���������������勉����勉��