in reply to Re^5: Why eval $version?
in thread Why eval $version?
That outputs "WTF".use strict; use warnings; my $str = "2.30"; our $VERSION = $str; $VERSION = eval $VERSION; print "WTF\n" if $VERSION ne $str;
I find that saner and preferable ... though I now always avoid using version strings that terminate with one or more zeros ... just in case ;-)use strict; use warnings; my $str = "2.30"; our $VERSION = $str; print "OK 1\n" if $VERSION == 2.3; print "OK 2\n" if $VERSION == $str; print "OK 3\n" if $VERSION eq $str; print $VERSION, " ", $str, "\n"; print "$VERSION $str\n"; __END_ outputs: OK 1 OK 2 OK 3 2.30 2.30 2.30 2.30
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^7: Why eval $version?
by Haarg (Priest) on Jul 09, 2020 at 18:28 UTC | |
by syphilis (Archbishop) on Jul 10, 2020 at 00:42 UTC | |
Re^7: Why eval $version?
by LanX (Saint) on Jul 09, 2020 at 15:42 UTC | |
by syphilis (Archbishop) on Jul 10, 2020 at 00:27 UTC | |
by LanX (Saint) on Jul 10, 2020 at 01:10 UTC | |
by syphilis (Archbishop) on Jul 10, 2020 at 02:36 UTC |