Perl shift operator simple question

后端 未结 5 1969
离开以前
离开以前 2021-01-19 03:33

What\'s the purpose of the following two lines of perl??

my $host = shift || \'localhost\';
my $port = shift || 200;

That should return loc

5条回答
  •  误落风尘
    2021-01-19 04:06

    shift return the first element of an array and removes it from the array. Like pop, but from the other end.

提交回复
热议问题