Hi!
I have a code that works perfectly well when I'm running it from the command line in Linux. But when I'm running it as a cron job it doesn't seem to work. (I'm running it from /etc/crontab) I think I've figured out that it is the split function that stops working. It looks like this:
@data = split(/(.*):[ ]*(.*)°(.*)=[ ]*(.*)°(.*)=[ ]*(.*)°(.*)/);
When I'm trying to print for example $data[1] perl tells me:
Use of uninitialized value in print at /searchpath/script.pl line 80, <INPUT> line 1.
The input comes from the following line:
open( INPUT, "/usr/bin/sensors | /bin/grep \"sensor = thermistor\" |");
I can print the input lines one by one, but not split them. I print them by putting the following line just before the split command:
print($_);
Anyone who has any ideas? I have been googling around for this for a few hours.
Thank you!
I have a code that works perfectly well when I'm running it from the command line in Linux. But when I'm running it as a cron job it doesn't seem to work. (I'm running it from /etc/crontab) I think I've figured out that it is the split function that stops working. It looks like this:
@data = split(/(.*):[ ]*(.*)°(.*)=[ ]*(.*)°(.*)=[ ]*(.*)°(.*)/);
When I'm trying to print for example $data[1] perl tells me:
Use of uninitialized value in print at /searchpath/script.pl line 80, <INPUT> line 1.
The input comes from the following line:
open( INPUT, "/usr/bin/sensors | /bin/grep \"sensor = thermistor\" |");
I can print the input lines one by one, but not split them. I print them by putting the following line just before the split command:
print($_);
Anyone who has any ideas? I have been googling around for this for a few hours.
Thank you!