in reply to path is broken

To pass a file name with spaces to the shell you have to backslash the file names:

$filename=~ s/(\s)/\\$1/g; $line_count = `wc -l $filename`;