http://qs1969.pair.com?node_id=1227575


in reply to Declare my variable in sysread - Mojo::File::slurp

It's the same trick as in
while (my $line = <$fh>) {
which is a shorthand for
while (defined( my $line = readline($fh) )) {
where, again, my $line appears as an argument operand of = which in turn is an argument operand of defined. my has two effects, one compile time and one run time. In compile time, you declare a lexical variable, and in runtime, you use it as an lvalue (i.e. assign a value to it). Variables declared in block conditions (if, while, unless, until) are accessible until the last conditional operator block.
if (my $x = func()) { print "$x accesible here"; } elsif ($x eq 0) { # even here, print "and also here: $x"; }

Updated.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]