Hi All, I am trying to make subroutine which asks (via a regular expr) where some files are and then list them - but I would like it to jump back to the start of the loop if it does not find any files.
The jumping part works if there are only files in the folder, as soon as there are files and folders it does not jump out of the loop. Can any body give me an idea how to break this one?? Thanks #!/usr/local/bin/perl -w use strict; sub filecheck { LINE: while (1 == 1) { #--- > I know this type of loop is not the best approach, but could not think of another way to do it. print "\nWhere are you file places (e.g /home/rfn/data/*.dat) ? ...\n\n"; chomp(my $files = <STDIN>); my @fil = glob("$files"); print "\nResult of your query:\n\n"; foreach my $check(@fil) { if ( not -e $check ) { print "\nno files\n"; redo LINE; } else { print "$check\n"; } } last; } print "\nYou did it!!\n"; } filecheck (); Cheers, Jakob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>