If you want to get a bit crazy, you can do something like the following:
undef $/;
$_ = <>;
print $1 if /([^\r\n]+\r?\n?)$/;
Of course, that reads the whole file into memory, which is generally a bad idea if you don't need to do it... but hey, there is always more than one way to do it.
Maybe somebody can provide an example of tying a variable to the file and then using the regex? Personally, Runrig's example is probably the best way to do it.
Zucan |