Sample
Code:
#!/usr/bin/perl
use strict;
use warnings;
use Astro::Sunrise;
my ($long,$lat) = qw (-842259 334359); # Specify yours or get from GPS
my $now = join(":", (localtime) [2,1]);
my $sun_rise = sun_rise($long, $lat);
my $sun_set = sun_set($long, $lat );
print "Now $now, sunrise \@ $sun_rise, sunset at \@ $sun_set\n";
if ($now gt $sun_rise and $now lt $sun_set){
print "It's daytime, do something!\n";
}else {
print "It's nighttime!, do something\n";
}