Next | Program Repair Shop | 14 |
Let's look at these two lines together:
my $usage = "NO ARGS! This perl script finds all duplicate files by content, not file name usage: $0 <options to find> example: $0 . -mount\n\n"; die $usage if @ARGV == 0;
This is the only place where $usage is used
This is an unusually surprising example of Use immediately follows assignment
When a variable is assigned, used once immediately, and never again, it can often be eliminated
As here; why not just:
die "NO ARGS! This perl script finds all duplicate files by content, not file name usage: $0 <options to find> example: $0 . -mount\n\n" if @ARGV == 0;
Or perhaps:
@ARGV > 0 or die "...";
Next | ![]() |
Copyright © 2006 M. J. Dominus |