#!/usr/bin/perl use strict; use Benchmark; my $Nfiles=shift; my $fh; my $fname; my ($t0,$tf,$dt); printf "Creating N=%i files\n",$Nfiles; $t0 = new Benchmark; foreach ( 1 .. $Nfiles) { $fname = sprintf "dir/f%i.dat",$_; open($fh,">".$fname) or die "FATAL ERROR: unable to open $fname\n"; printf $fh "fname=%s\n",$fname; close($fh); } $tf = new Benchmark; $dt = timestr(timediff($tf,$t0)); printf "Creating N files took %s seconds\n",$dt;