Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Unable to retrieve the string bist_top_ctrl from a file

by hrcerq (Scribe)
on May 22, 2021 at 15:55 UTC ( [id://11132890]=note: print w/replies, xml ) Need Help??


in reply to Unable to retrieve the string bist_top_ctrl from a file

Hi, aside from the other suggestions, you could also use split instead of a regex with a capture group, supposing this file will always be structured as a two-column CSV.

while (my $line = <$in>) { my @fields = split /,/, $line; if ($fields[0] = "controller_name") { $fourth = $fields[1]; } }

It could be further improved, but it's just so you get the picture.

Update: The fields variable had the wrong sigil and wasn't lexical. Now corrected.

return on_success() or die;

Log In?
Username:
Password:

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

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

    No recent polls found