in reply to Re: open file error
in thread open file error

I used chomp on $logfile to get rid of any space. Actually I think you didn't get my problem, I am extracting the file name from the $run_cmd string and using it further along with a $rundir_path variable. I am unable to figure our why after using chomp , why this is happening.

Replies are listed 'Best First'.
Re^3: open file error
by Corion (Patriarch) on Jul 19, 2016 at 11:02 UTC

    Feel free to use different approaches.

    As a hint, maybe you want to re-read chomp - it will not remove space (chr(32)) from the end of a string. But as I already showed you how to diagnose the problem, you certainly have found out by using my advice that whitespace at the end of $logfile was not the case for the difference between the hardcoded filename working and the dynamic filename not working.

    Please show us again the code that works and the code that fails, together with the diagnostic that ascertains that there is no whitespace at the end of the filename you use in the dynamic case.

      oh i got it ... i should have read chomp properly, i used a regex to trim the spaces from both ends of any string

      $logfile =~ s/^\s+|\s+$//g;

      and now it's working. Sorry for the not so intelligent answer above :P please don't down vote that :) Thanks