in reply to Re^6: Epoch time conversion script
in thread Epoch time conversion script

Well, the while loop lidden provided has no syntax errors, so show your code

I removed the <> tags from <$in>

that had nothing to do with the error, that was reading the file, that is readline

Replies are listed 'Best First'.
Re^8: Epoch time conversion script
by hedkandi (Initiate) on Apr 06, 2012 at 03:32 UTC

    Hi anonymous monk Thank you for pointing that out. Here's the result again

    # more perl_epoch open my $in, '<', 'jabadm_history' or die "Bummer: $!"; open my $out, '>', 'jabadm.txt' or die "What: $!"; while(my $line = <$in>){ if(my ($epoch) = $line =~ /^#\+(\d+)\s*$/){ my $human_readable = `date -d \@$epoch`; # or: # my $human_readable = scalar localtime $epoch; print $out $human_readable; } else{ print $out $line; } } # ls -lrt jabadm_history -rw-r--r-- 1 jabadm sapsys 1518 Mar 27 13:31 jabadm_history # ./perl_epoch ./perl_epoch: line 1: open: command not found ./perl_epoch: line 2: open: command not found ./perl_epoch: line 4: syntax error near unexpected token `)' ./perl_epoch: line 4: `while(my $line = <$in>){'

      Well, perl is not executing that program

      If you're not going to type  perl program you need to set the shebang correctly, for ex  #!/usr/bin/perl --

      More on this in perlrun, Behind the GUI lives the Shell (enable javascript for images)