in reply to here is a script to log what you do during the day...

$output = capture("$comando"); ... $outTitolo = capture("$titolo");

Why are you copying $comando and $titolo to strings instead of using them directly?

What's wrong with always quoting "$vars"?



undef my $oreTotali;

Why would you use undef there?    Just because you can?    It is superfluous in that context.



print FILE "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";

Probably better as:

print FILE "\n" x 17;


sub count_unique { my @array = @_; my %count; map { $count{$_}++ } @array;

Why make a copy of @_ when you don't really have to?    Why use map in void context and create a list that you are not going to use?

sub count_unique { my %count; $count{$_}++ for @_;

Replies are listed 'Best First'.
Re^2: here is a script to log what you do during the day...
by ikegami (Patriarch) on Feb 07, 2011 at 21:51 UTC

    Why use map in void context and create a list that you are not going to use?

    No list is built in void context anymore.

    The only thing that got created and not used is the SVs created by post-increment. $x++ automatically gets converted to ++$x in void context, so your for rewrite doesn't suffer from this whereas the original did.

      No list is built in void context anymore.

      Ah yes ... gianni didn't say which version of Perl was used so you can't assume that.    :-)

        I don't know what you think I said, but I didn't make any assumptions. I even verified that the passage you quoted was true* before posting it.

        * — The body of the map still creates a list (of one value in this case), but the list that map would return is not created.

Re^2: here is a script to log what you do during the day...
by gianni (Novice) on Feb 07, 2011 at 11:24 UTC
    Thank you very much for your corrections