Printing a message in file without opening it in perl

Hello friends,

i have a perl script as below ...

for (0 ..$#values)
{

##want to print some message here in Report.txt file

print `find /abc/xyz/pqr/$values[$a]" -type f -ls` >> Report.txt

}

I am able to get output of

print `find /abc/xyz/pqr/$values[$a]" -type f -ls` >> Report.txt

in Report.txt file.

but print "message " >> Report.txt is not working....

Can anyone help me....

  1. What is the exact requirement?
  2. You could use File::Find module of perl if you want to traverse through a directory structure.
1 Like

Thanks for your time friend.
Here are the answers for your question:-

  1. Exact requirement is that i am listing output(how many files are there with timestamp) of specified directories in a file(Report.txt).
    But before printing output for every directory in loop i want to print a Message in Report.txt file that this output is for this "specified directory"....
  2. I will also try with that.... :slight_smile: ...

---------- Post updated at 09:43 PM ---------- Previous update was at 09:43 PM ----------

Thanks for your time friend.
Here are the answers for your question:-

  1. Exact requirement is that i am listing output(how many files are there with timestamp) of specified directories in a file(Report.txt).
    But before printing output for every directory in loop i want to print a Message in Report.txt file that this output is for this "specified directory"....
  2. I will also try with that.... :slight_smile: ...