#!/usr/bin/perl -w use strict; use IO::Dir; my $rootdir = "."; my $lastno = GetLastNumber($rootdir) + 1; my $newpl = "$rootdir/sample_${lastno}.pl"; # forgot to add .pl extens +ion # thanks jweed. system "vim $newpl && rm current_test && ln -s $newpl current_test"; sub GetLastNumber { my $dir = shift; my $d = IO::Dir->new($dir) or die "Can not open directory $dir for read!"; my $lastno = 0; while (defined(my $f = $d->read)) { next if $f !~ /sample\_\d+\.pl/; my ($no) = $f =~ /sample_(\d+)\.pl/; $lastno = $no if $no > $lastno; } return $lastno; }
In reply to Re: Perl test management
by Roger
in thread Perl test management
by jweed
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |