In the substitution operator the right hand side is evaluated in scalar context and thus localtime returns the formatted date as a string as per documentation:
use strict; use warnings; my @x = localtime 1503403724; print "@x\n"; my $x = localtime 1503403724; print "$x\n"; my $z = "ccc"; $z =~ s/ccc/wantarray()?"list":"scalar"/e; print "$z\n";
In reply to Re: one liner automagic strftime()
by hdb
in thread one liner automagic strftime()
by seki
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |