I don't know how "cool" this is (it's cool to me) but this is a small script I wrote 13 years ago. It simply converts and prints out the Perl version contained in the built-in variable $] to the string as we usually see it when we are discussing Perl releases. Just run it, you'll see what I mean ;-).
#!/usr/bin/env perl # First created: 2012-05-08 # Last modified: 2012-08-26T01:37:48 UTC-04:00 use strict; my $pow = 2; my $test_v = $ARGV[0] || $]; my @qiu = split(q/[._]/ => $test_v); @qiu[1 .. @qiu] = map {sprintf(q[%u],$_/10**$pow++)} map {unpack "A4 A4",$_ * 10**3 } @qiu[1 .. $#qiu]; my $tuple_perlversion = join q[.], grep{length($_)} @qiu; print "$tuple_perlversion\n";
Soren
Jul 12, 2025 at 17:07 UTC
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Display common "tuple" rendition of Perl $] variable
by LanX (Saint) on Jul 12, 2025 at 18:05 UTC | |
by ikegami (Patriarch) on Jul 12, 2025 at 21:04 UTC |