in reply to what difference between eval and do ?

Another difference:

sub hello_do { do { return; }; print "Hello from hello_do\n"; } sub hello_eval { eval { return; }; print "Hello from hello_eval\n"; } hello_do(); hello_eval(); __DATA__ Hello from hello_eval
return is the return value of the eval itself, but the return value of the function calling do.

Replies are listed 'Best First'.
Re^2: what difference between eval and do ?
by Anonymous Monk on Apr 21, 2018 at 13:38 UTC
    As I replied before, That's because eval is a sub call, but do is a block. just image: s/eval/sub Foo/