im trying to make this part of my code work and im stuck for ideas...
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); } } } }
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:
if ($overwrite =~ (m^/[nN]{1}$/)) { redo FILENAME; }
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!

In reply to returning to a loop later on by Yoda_Oz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.