Perl - Script working in Padre, Windows. But not in Linux Ubuntu -
i've tried transfer script on i've been working on in windows. fails @ first hurdle.
use strict; use warnings; $keywordfile = 'keyword.txt'; open(keywords, $keywordfile) or die "$keywordfile not found\n"; @keywordarray; while ( $line = <keywords> ) { chomp $line; push @keywordarray, $line; } close(keywords);
it keeps on dying, though in same destination there file called 'keyword.txt'. issue coming ubuntu, or perl wrong?
it keeps on dying, though in same destination there file called 'keyword.txt'
relative paths resolved against working directory (i.e. directory script run from), not directory in script located.
you should either
- run script directory contains needed files
- use
findbin
module script location , use path refer file names:
eg.
use finbin; $keywordfile = "$findbin::bin/keyword.txt";
Comments
Post a Comment