match pattern of multiple lines

From: John Black (black_at_eed.com)
Date: 07/16/04


Date: Thu, 15 Jul 2004 16:26:28 -0600


Hi,
     I need to match the following pattern with a file,

       begin <some string>
        <some thing this line>
        <some thing this line>
        ......
        end

    I check the web, it says I should use pattern modifier s & m, so I
write it this way,

        while (<MyFile>){
           if (/^(\s*)begin(.*)^(\s*)end/smi){
              ... call my function...
           }
        }

    But it never matches the pattern, do you see the problem?

Thanks!