4 ms·
could be much worse # launch debugger with the program provided inline, consisting of the statement `1`. # this program is ignored and we just mess with so
by fennecfoxen 6y ago
could be much worse
# launch debugger with the program provided inline, consisting of the statement `1`.
# this program is ignored and we just mess with some variables.
% perl -de1
Loading DB routines from perl5db.pl version 1.57
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.
main::(-e:1): 1
DB<1> @a = (1..4)
DB<2> x \@a
0 ARRAY(0x7faf890418f8)
0 1
1 2
2 3
3 4
DB<3> x scalar @a
0 4
DB<4> sub foo { return (1..4) }
DB<5> @b = foo()
DB<6> x scalar @b
0 4
DB<7> x scalar foo()
0 ''
yes, that's the empty string, aka false, because the .. operator returns entirely different things in scalar context so you can write code like
while (<STDIN>) {
next if /^BEGIN$/ .. /^END$/;
# ...
}