kansaschuck has asked for the wisdom of the Perl Monks concerning the following question:

I'm hunting for some records in a file. In my old PHP programs I have some good code to grab special records. I'll need to do the same in Perl... such as:
if(preg_match('/sacts=(.*)=eacts/i', $uscaption, $matches))
So I'll have a program passing a record/file, in that record are some passed number such as specialnumber=9 specialword=foo or as in the case above "sacts=11:22:33=eacts" So if I could find the string in a file that starts with x and end with y, or starts with x and end with a space that would be good. The current code (in PHP) finds record that start with x and ends with y and then I do a string replace for x and y (or 'acts=' and '=eacts' in my php example) and I'm left with my value. Not award winning code but it's getting the job done. So I'm looking for the same in Perl, or I'm open to new Perl suggestions. Thanks!

Replies are listed 'Best First'.
Re: strings searches
by ikegami (Patriarch) on Feb 05, 2008 at 00:57 UTC

    The line is equivalent to

    if(@matches = $uscaption =~ /sacts=(.*)=eacts/i)

    Do you need more than that?