can anybody see whats going wrong or any better way of coding this? i keep getting an error "Search pattern not terminated at perl.pl line 121." basically its the:while ($out !~ m/^[sSfF]{1}$/) { print ("Do you want to output to (S)creen or to (F)ile?\n"); chomp($out=<STDIN>); print("\nInvalid input.\n Please type either S or F.\n"); } if ($out =~ m/^[sS]{1}$/) { print $output; } elsif ($out =~ m/^[fF]{1}$/) { FILENAME: { while ($save !~ (m/^[a-zA-Z]{1}[a-zA-Z_0-9]*$/)) { print ("Please enter filename:\n"); chomp($save=<STDIN>); print("\nInvalid input.\n Please begin with a letter a +nd do not add extension, it will be added automatically.\n"); } if (-e $save) { while ($overwrite !~ (m/^[nNyY]{1}$/)) { print("\nFilename exists. Overwrite? (Y) or (N)\n" +); chomp($overwrite=<STDIN>); print("\nInvalid input.\n Please type either Y or +N.\n"); } if ($overwrite =~ (m^/[nN]{1}$/)) { redo FILENAME; } else { open(DATA, ">$save")|| die "Couldn't open $path fo +r writing: $!\n"; print DATA $output; close (DATA); } } } }
thats giving me grief, and is causing the error. because if i get rid of that snippet it works fine, but then it doesnt do hat i want it to. hope you guys can understand what im talking about. cheers!if ($overwrite =~ (m^/[nN]{1}$/)) { redo FILENAME; }
In reply to returning to a loop later on by Yoda_Oz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |