PERL 7 for what it really matters - Page 1
Forum section: electronics / general

author: PKTKS
author_rank: Super Contributor
timestamp: May 28, 2022, 10:21:06 am
content: PERL (besides all attempts...) is by far not dead...http://blogs.perl.org/users/psc/2022/05/what-happened-to-perl-7.htmlPaul

author: gmb42
author_rank: Frequent Contributor
timestamp: May 28, 2022, 08:24:50 pm
content: Random thoughts.If Perl, and especially Perl 7, is ever the answer then the question is fundamentally flawed in the first place.Time to stop beating that dead horse!Most folks seem to agree:https://www.tiobe.com/tiobe-index/perl/Perl isn't being killed off, it's dying due to lack of usefulness.

author: cfbsoftware
author_rank: Regular Contributor
timestamp: May 28, 2022, 11:27:20 pm
content: Quote from: gmb42 on May 28, 2022, 08:24:50 pmHere's another another estimate of what 'folks' might be thinking:QuoteHowever PERL doesn't get a mention here at all. I don't use PERL myself but most of the other languages I use in my daily work don't get a mention either. Do I give a toss?

author: Foxxz
author_rank: Regular Contributor
timestamp: May 29, 2022, 01:46:18 am
content: Perl is one of the languages I started off with. It is concise and allows you to accomplish alot with minimum code. The language doesn't get in the way of allowing you to accomplish whatever. That ability comes with tradeoffs.I hate python even though its all the rage. Don't force me into something ad petty as white-space code formatting. What a croc. And while we're at it, lets change the names of arrays and other common industry established data constructs.Does Perl allow you to write sloppy and unreadable code? Yes. But if I cared in the first place I wouldn't have done it.

author: SiliconWizard
author_rank: Super Contributor
timestamp: May 29, 2022, 02:25:57 am
content: Perl is still being used, so no it's not dying, apparently.If the tool does the job, what's the problem?

author: brucehoult
author_rank: Super Contributor
timestamp: May 29, 2022, 07:41:00 am
content: I use Perl 5 every single day. I have no interest in what they did to it in Perl 6. I guess I should look at 7, but I don't have high hopes.Here's something I was just running a few minutes before I found this post:Code:Mac-mini:~ bruce$ curl http://hoult.org/bruce.ip 2>/dev/null | grep '\.' | perl -ne 'sub p {print "$s $n\n" if $n!=0} chomp; if($_ eq $s){++$n}else{p;$s=$_;$n=1}; END {p}'103.152.127.142 125103.152.127.143 480103.152.127.142 283103.152.127.143 3103.152.127.142 1103.152.127.143 37103.152.126.179 537103.152.126.178 16103.152.127.164 600103.152.126.144 62103.152.126.145 180103.152.126.144 262103.152.127.166 247103.152.126.147 11103.152.127.163 441103.152.127.162 74103.152.127.163 64206.83.116.202 1282It goes on a bit longer than that. List of how in how many consecutive 15 minute periods I had the same IP number on Starlink, starting at the beginning of February.If I want something perl'ish but with more conventional data structures and functions and so forth then I use Ruby.

author: PKTKS
author_rank: Super Contributor
timestamp: May 29, 2022, 08:17:40 am
content: 2x of usI dont like the things on PERL 6 and stick plain 5.. but it seems the steering folks want to veer things back to placePERL has no substitutePaul

author: magic
author_rank: Super Contributor
timestamp: May 29, 2022, 09:40:05 am
content: I knew Perl 6 will be a flop when I saw their mascotOr that the initial implementation was in Haskell.Perl 5 is useful as it's available on virtually every Linux system and better suited to short scripts than some popular alternative.I wouldn't use it for any "serious software", though.

author: PKTKS
author_rank: Super Contributor
timestamp: May 30, 2022, 08:24:59 am
content: Actually besides despite against all attempts to deprecate perl ..You just can not compile install and keep a distro wo it...The systemd party has been trying way too hard thatSo farNever really worked and PERL7 should put things back to normalPaul

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 30, 2022, 01:33:01 pm
content: Some time ago I wanted to add a scripting language to my vocabulary (only used C and C++ before) and Perl seemed a quite nice candidate.In the end I settled for python. I find it a quite distasteful language but I don't have much choice. It's used as the scripting language in almost every program I use (KiCad, FreeCAD, Sigrok/Pulseview)Good riddance of Python V2. That took at least 8 years too long to get rid of, but the horrible whitespace dependency still remains.I once wanted to create a diff for a bug report of Meld. The error was a few missing spaces in the last line of a for loop, which dropped that line out of the loop.But this is a pearl thread, so I'll shut up now.

author: emece67
author_rank: Frequent Contributor
timestamp: May 30, 2022, 04:28:32 pm
content: .

author: PKTKS
author_rank: Super Contributor
timestamp: May 30, 2022, 06:16:17 pm
content: Quote from: brucehoult on May 29, 2022, 07:41:00 amInteresting... ... never occurred to me using curl that way.. with custom argument and custom sortingput desired URL as argumentCode:$s;$n=0; $\="\n"; sub p{ $fhs{$s}=$n if $n; $s=$_;$n=1;}open PIPE, 'curl '.shift.'|' or die('PIPE Failed');while(<PIPE>){ chomp; next unless m/\d+\.\d+\.\d+\.\d+/; ($_ eq $s) ? $n++:p;} p;close PIPE; foreach (sort {$b cmp $a} keys %fhs) { push(@fhs,$fhs{$_}."\t".$_); }foreach (sort {$a <=> $b} @fhs) { print; }1 206.83.116.2101 206.83.116.1511 103.152.127.1422 206.83.116.613 206.83.116.25311 103.152.126.14716 103.152.126.17836 206.83.116.21837 103.152.127.14364 103.152.127.16374 103.152.127.16291 206.83.116.697 206.83.116.232180 103.152.126.145187 206.83.116.142191 206.83.116.132193 206.83.116.228247 103.152.127.166262 103.152.126.144372 206.83.116.192537 103.152.126.179559 206.83.116.201580 206.83.116.166600 103.152.127.164660 206.83.116.2401784 206.83.116.202PERL made me rethink the way I think..btw: this wrap isstilla plain onelinerPaul

author: brucehoult
author_rank: Super Contributor
timestamp: May 31, 2022, 02:09:48 am
content: It's of course nice that you can do it all inside perl using a pipe and hash or array but keeping much of it in bash works well for me.I can get effectively the same output as yours by just appending| sort -nk2to my bash line. Or get actually the same as yours by changing the print in the perl and using| sort -nk1. Or| awk '{print $2"\t"$1}' | sort -nk1(or perl instead of awk)

author: SiliconWizard
author_rank: Super Contributor
timestamp: May 31, 2022, 02:40:44 am
content: I admit I'm personally no good at PERL and would thus use another tool for that kind of stuff, but if you're reasonably proficient in it, then just use it. It's a tool that is not likely to die anytime soon, contrary to what some people prophetize.

author: PKTKS
author_rank: Super Contributor
timestamp: May 31, 2022, 02:48:30 pm
content: Quote from: brucehoult on May 31, 2022, 02:09:48 amPERL just gives a banana for that kind of concern...Both uses on a sameonelinercan be piped or called either way..This time with IPV4SORT custom sortingCode:$\="\n"; $s='';$n=0; sub p { $fhs{$s} = $n if $n; $s = $_; $n = 1; }if ( scalar @ARGV ) { open PIPE, 'curl '.shift.'|' or die('PIPE Failed');while(<PIPE>) { chomp; next unless m/\d+\.\d+\.\d+\.\d+/; ($_ eq $s)?$n++:p; } p; close PIPE;} else {while(<>) { chomp; next unless m/\d+\.\d+\.\d+\.\d+/; ($_ eq $s)?$n++:p; } p;} foreach( map{ $fhs{$_}."\t".$_ } ipv4sort keys %fhs) { print; }262 103.152.126.144180 103.152.126.14511 103.152.126.14716 103.152.126.178537 103.152.126.1791 103.152.127.14237 103.152.127.14374 103.152.127.16264 103.152.127.163600 103.152.127.164247 103.152.127.16691 206.83.116.62 206.83.116.61191 206.83.116.132187 206.83.116.1421 206.83.116.151580 206.83.116.166456 206.83.116.192559 206.83.116.2011784 206.83.116.2021 206.83.116.21036 206.83.116.218193 206.83.116.22897 206.83.116.232660 206.83.116.2403 206.83.116.253PERL is AWK on heavy steroids..and a very clever logic spectrumyou can even do ipv6 sorting instead by direct translationPaul