how to tail a file in perl

Can any one please help why does tail -f does not work in the below code:

Thanks in advance.

 
#!/usr/bin/perl -w
 
my $path = "/home/cs/logs/";
my $log = "log.txt";

`cd $path`;
`tail -f $log`;

Does this help you?

#!/usr/bin/perl

use strict;
use warnings;

open my $pipe, "-|", "/usr/bin/tail", "-f", "./SampleLog.log" or die "could not start tail on SampleLog.log: $!";
print while <$pipe>;

Or you could forgo external programs and use File::Tail

Thanks much dahlia. It work!!!

I will also try File::Tail! thanks.