'extracting' from a string via regular expressions?



Hi,
I was modifying code written by others when something stopped working.
I was using a construct like:
$string=~ m@PartOne(.*)PartTwo@;
to find and extract everything between 'PartOne' and 'PartTwo', and I
swear it was working. Then I moved to a different string and it
stopped working (and now the first example also stopped working).
Below is a not-working test-case:

#! /usr/bin/perl

use strict;

# Definition of variables
my $line;
my $file;

# Read file
@ARGV = qw# test2.csv #;
while (defined($line = <>)) {
$file .= $line;
}

$file=~ m@TEMPLATES(.*)ONLY@;

print $file . "\n";

The file test2.csv contains just one sentence: 'IMPORTANT: THESE
TEMPLATES MAY ONLY BE USED WITH THE WRITTEN PERMISSION'
Therefore, the code above should print simply 'MAY' (possibly with the
spaces), but it prints the whole sentence.

Finding the word 'TEMPLATES' works fine, a la:
if ($file=~ m@TEMPLATES@) {
print "It matched!" . "\n";
}
works fine.

So, what am I missing here?
Thanks.

.