Next | Program Repair Shop | 121 |
`date`
Other common culprits here:
@files = `ls`; @files = `ls *.c`;
Use glob('*') or glob('*.c') instead
$data = `cat file`;
Use
{ my $fh = FileHandle->new('file'); local $/; $data = <$fh>; }
(Make this into a function if you do it a lot.)
$cutvar = `echo $array[0] | cut -c1-7`;
Use
$cutvar = substr($array[0], 0, 7);
In this last case, what if $array[0] contains a * character?
Next | Copyright © 2002 M. J. Dominus |