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;
|
---|
In Section
Seekers of Perl Wisdom