perl
-
Perl One-Liners Guide with plenty of examples and exercises
cross-posted from: https://programming.dev/post/3619339
> Hello! > > I am pleased to announce a new version of my Perl One-Liners Guide ebook. > > Perl has a feature rich regular expression engine, plenty of builtin modules and a thriving ecosystem. Another advantage is that Perl is more portable. This book will show examples for filtering and substitution features, field processing, using standard and third-party modules, multiple file processing, how to construct solutions that depend on multiple records, how to compare records and fields between two or more files, how to identify duplicates while maintaining input order and so on. > > Links: > > * PDF/EPUB versions: https://learnbyexample.gumroad.com/l/perl-oneliners or https://leanpub.com/perl-oneliners/c/new_perl_release (free till 07-October-2023) > * Web version: https://learnbyexample.github.io/learn_perl_oneliners/ > * Markdown source, example files, etc: https://github.com/learnbyexample/learn_perl_oneliners > > I would highly appreciate it if you'd let me know how you felt about this book. It could be anything from a simple thank you, pointing out a typo, mistakes in code snippets, which aspects of the book worked for you (or didn't!) and so on. Reader feedback is essential and especially so for self-published authors. > > Happy learning :)
-
Quickly benchmark commands using Perl
cross-posted from: https://lemmy.ml/post/4027414
> TIL that I can use Perl's
Benchmark
module to time and compare the performance of different commands in an OS-agnostic way, ie as long as Perl is installed. > > For example, to benchmark curl, wget and httpie you could simply run: > >Perl > $ perl -MBenchmark=:all \ > -E '$cmd_wget = sub { system("wget https://google.com > /dev/null 2>&1") };' \ > -E '$cmd_curl = sub { system("curl https://google.com > /dev/null 2>&1") };' \ > -E '$cmd_httpie = sub { system("https https://google.com > /dev/null 2>&1") };' \ > -E '$timeresult = timethese(15, { "wget" => $cmd_wget, "curl" => $cmd_curl, "httpie" => $cmd_httpie });' \ > -E 'cmpthese($timeresult)' >
> > which on my old T530 produces: > >> Benchmark: timing 15 iterations of curl, httpie, wget... > > curl: 2 wallclock secs ( 0.00 usr 0.00 sys + 0.42 cusr 0.11 csys = 0.53 CPU) @ 28.30/s (n=15) > httpie: 8 wallclock secs ( 0.00 usr 0.01 sys + 4.63 cusr 0.79 csys = 5.43 CPU) @ 2.76/s (n=15) > wget: 3 wallclock secs ( 0.00 usr 0.00 sys + 0.53 cusr 0.19 csys = 0.72 CPU) @ 20.83/s (n=15) > > Rate httpie wget curl > httpie 2.76/s -- -87% -90% > wget 20.8/s 654% -- -26% > curl 28.3/s 925% 36% -- >
> > Very handy indeed ❤ -
In the current Perl class experiment, is there a way to override a method and refer to super?
I did not find anything mentioning this anywhere, but it is such a basic feature of class based programming, that I can't imagine it is not there, somewhere, somehow.
class One { method do_it {say 1} } class Two : isa(One) { method do_it { super()->do_it; say 2} } # or so...
-
Perl Weekly #619
dev.to Perl Weekly #619 - Maintenance of CPAN modulesOriginally published at Perl Weekly 619 Hi there! There are way too many CPAN modules that are...
Perl Weekly #619
-
Is there a list of features that are NOT yet implemented in the v6 module?
v6 looks like nice and my Raku skills are definitely not at the level that I would need the (albeit very nice) MoarVM stack. So is there like a list of things that have not yet been implemented in the v6-perlito module? It's also nice that it works in different languages, javascript is very optimized and Go can be bytecompiled, so if my stuff is slow with MoarVM, I could always try those others out.