#!/usr/bin/perl # run with crontab: # */5 * * * * (cd public_html/arduino; ./sample-light.pl) use strict; my $data = `curl -s 'http://98.232.243.25:8082/a'`; my $time = time; my @data = $data =~ /(\d+)/g; record('light', $data[0]/100.0+50); sub record { my ($code, $sample) = @_; mkdir "results/$code" unless -e "results/$code"; open H, ">>results/$code/history.txt"; print H "$time\t$sample\n"; }