Unix command in Perl

Hi,

I have a perl script. It needs to open a file but the file that it will open will depend on the result of a unix command "tail -1". How can I do that in perl, to open a file which is the results from a unix command? Thanks in advance! Hope you can help me.

this sample should help you !

#! /opt/third-party/bin/perl

$a=`ls | tail -1`;

print "file:$a";

exit 0

Hi Matrixmadhan,

It's you again! Thanks a lot for always taking time to reply on my posts. I was able to do it now but I will also try to do the command that you've recommended. :slight_smile: