directory - Why does my Perl open() fail with "Unsuccessful open on filename containing newline"? -


I tried to put $ {date] [0]} in my directory 01252010 but @hits is not printed How can I open directories to get the desired output? Thank you.

ERROR: The filename contained in the new line failed / /. Total line line 11, line 1

  #! / Opt / Pearl / Bin / Pearl - W strict use; Open (FH, "/ home / daily / scripts / sms_hourly_stats / date.txt"); My @date = & lt; FH> Print date $ [0]; My $ path = "/home/daily/output/sms_hourly_stats/${date[0]}/TOTAL.txt"; Open (file, "$ path") or dead "Unable to open $ path: $!"; My @ hit = & lt; FILE & gt; Print @ hits; Close the FH; Close the file;  

You need to remove the lines that end the line. Use:

  chomp (my @date = & lt; FH>);  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -