Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^6: Bugfixing Old Code

by NetWallah (Canon)
on Jul 23, 2021 at 18:21 UTC ( [id://11135350]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Bugfixing Old Code
in thread Bugfixing Old Code

You are correct - the capturing parens are not necessary,
In that case, the originally posted code is correct:
# Split on multiple spaces using regex captured matches my @temp_and_starts = $_ =~ /[^\s +]+/g; my @last_AT_fracs = <$in> =~ /[^\s +]+/g; my @twenty_SFs = (<$in> . <$in> . <$in> . <$in>) =~ /[^\s +]+/g;
and my test below shows that it works:
$ perl -E '$_="This and that and other";@x= $_=~ /[^\s]+/g;; say for +@x' This and that and other

                "The difficult we do today; the impossible takes a little longer."

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11135350]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2024-04-26 03:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found