Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Unable to retrieve the string bist_top_ctrl from a file

by hrcerq (Scribe)
on May 22, 2021 at 15:55 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2022-05-25 13:51 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (90 votes). Check out past polls.