in reply to Search for a string in a file and get the string in the next line

Although it looks like you've found a solution, I thought I'd toss out another idea.

You could use Tie::File. As you iterate through the array (aka lines of the file), search for the PSP-Ri string and then if it's found, print the next element (aka line of the file) or formatted portions of it as desired.

Not advocating this to be a better approach, just a different approach.

  • Comment on Re: Search for a string in a file and get the string in the next line