develooper Front page | perl.perl5.porters | Postings from April 2021

Strange lines order for: exec or print "foo"; die "bar"

Thread Next
From:
Михаил Козачков
Date:
April 29, 2021 08:36
Subject:
Strange lines order for: exec or print "foo"; die "bar"
Message ID:
8e2eef3a-2354-ee5c-7889-28afab16ae86@gmail.com
When we use exec in form of: exec LIST or print "foo"; die "bar";
it gives wrong (I guess) lines order in output subject to presence of
"\n" in print statement:

perl -E 'use warnings; exec "echo 1" or print "First line";
die "Second line";'
1

perl -E 'use warnings; exec "echos 1" or print "First line";
die "Second line";'
Can't exec "echos": No such file or directory at -e line 1.
Second line at -e line 1.
First line

perl -E 'use warnings; exec "echos 1" or print "First line\n";
die "Second line";'
Can't exec "echos": No such file or directory at -e line 1.
First line
Second line at -e line 1.

Is it a normal behavior or not?

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About