Hi Perl-Meisters,

My "if" loop didn't work with "last" so I changed "if" to "while", but it 
seems that the "redo" doesn't cause the "while" to re-evaluate with the new 
value of $destfile. When I run this and type something other than "yes" I 
get the message "File foobar already exists..." (even though 'it don't')

while (-e $destfile) {
  print "$destfile exists. Enter new name or type \"yes\" to overwrite: ";
  chomp ($_ = <STDIN>);
  last if $_ =~ /yes/i;
  $destfile = $_;
  redo;
}

perldoc -f redo says '"redo" cannot be used to retry a block which returns a 
value...'; that I've learned, but maybe someone can suggest a better way 
(would that be 'use a subroutine'?)...

-- 
Kevin Pfeiffer <[EMAIL PROTECTED]> - www.iu-bremen.de



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to