60 PerlMonks - Newest Nodes New nodes appearing on PerlMonks http://perlmonks.org/index.pl?node_id=30175 http://blogs.law.harvard.edu/tech/rss PerlMonks Newest Nodes XML Generator PerlMonks http://perlmonks.org/ clean,rss 20240220160358 Anonymous Monk Tue Feb 20 16:03:58 2024 30 2024-02-21 03:03:58 Tue Feb 20 16:03:58 2024 961 Re^2: Basic syntax displayed up front Danny http://perlmonks.org/index.pl?node_id=11157826 I was actually thinking of having it as one of the items in the header at the top, but as noted above, the info below the posting text area is probably enough. Plus there is already the "Need Help??" ... note Wed, 21 Feb 2024 00:47:57 +0000 http://perlmonks.org/index.pl?node_id=11157826 11157826 1105934 2024-02-20 19:47:57 Danny Re^2: Basic syntax displayed up front Danny http://perlmonks.org/index.pl?node_id=11157825 Ah. That's actually very nice and probably more than sufficient. I guess I forgot about that.... note Wed, 21 Feb 2024 00:39:28 +0000 http://perlmonks.org/index.pl?node_id=11157825 11157825 1105934 2024-02-20 19:39:28 Danny Re^6: RE on lines read from in-memory scalar is very slow NERDVANA http://perlmonks.org/index.pl?node_id=11157824 Ah-ha! Well that helps improve my understanding for future attempts at optimizing my scripts.... note Wed, 21 Feb 2024 00:10:53 +0000 http://perlmonks.org/index.pl?node_id=11157824 11157824 1218269 2024-02-20 19:10:53 NERDVANA Re^2: Confused by RegEx count NERDVANA http://perlmonks.org/index.pl?node_id=11157823 Or you could just match instead of substitute, for a few percent faster. sub match { my $count =()= $str =~ /$q/g } ... note Wed, 21 Feb 2024 00:06:54 +0000 http://perlmonks.org/index.pl?node_id=11157823 11157823 1218269 2024-02-20 19:06:54 NERDVANA Re^5: RE on lines read from in-memory scalar is very slow tonyc http://perlmonks.org/index.pl?node_id=11157822 The regex engine currently always makes a CoW copy (ie doesn't copy the string itself) of the matched string. There's no CoW substrings - perl's PVs are stored with a trailing NUL so they... note Wed, 21 Feb 2024 00:01:57 +0000 http://perlmonks.org/index.pl?node_id=11157822 11157822 481763 2024-02-20 19:01:57 tonyc Re^4: RE on lines read from in-memory scalar is very slow NERDVANA http://perlmonks.org/index.pl?node_id=11157821 I had forgotten about reflecting writes to the string, that would certainly nix the idea of using copy-on-write substrings. Does the regex engine *always* make a full clone of the target? Ca... note Tue, 20 Feb 2024 23:43:09 +0000 http://perlmonks.org/index.pl?node_id=11157821 11157821 1218269 2024-02-20 18:43:09 NERDVANA Re: Confused by RegEx count choroba http://perlmonks.org/index.pl?node_id=11157820 Other monks have already explained what's going on. Let me point to efficiency of the solutions: Note that the transliteration is much faster than the other option. Even when the character is va... note Tue, 20 Feb 2024 23:38:29 +0000 http://perlmonks.org/index.pl?node_id=11157820 11157820 832495 2024-02-20 18:38:29 choroba Re^3: RE on lines read from in-memory scalar is very slow tonyc http://perlmonks.org/index.pl?node_id=11157819 The problem with what I think you're suggesting is readline/sv_gets() doesn't know about the SV behind a file handle created from a reference, it's just another file - one where the buffer isn't th... note Tue, 20 Feb 2024 22:57:58 +0000 http://perlmonks.org/index.pl?node_id=11157819 11157819 481763 2024-02-20 17:57:58 tonyc Re^4: RE on lines read from in-memory scalar is very slow NERDVANA http://perlmonks.org/index.pl?node_id=11157818 I'm just saying that I've run into cases where for (split /\n/, $longstring) { ... } ran faster than open my $fh, ') { .... ... note Tue, 20 Feb 2024 22:03:52 +0000 http://perlmonks.org/index.pl?node_id=11157818 11157818 1218269 2024-02-20 17:03:52 NERDVANA Re^4: Raku: * v. $_ (asterisk v. the topic variable) 7stud http://perlmonks.org/index.pl?node_id=11157817 That's some comment! Thanks!... note Tue, 20 Feb 2024 21:54:27 +0000 http://perlmonks.org/index.pl?node_id=11157817 11157817 805072 2024-02-20 16:54:27 7stud