Way too long.

If you're having trouble with usernames, trim it down to just that fragment. Throw that fragment into a test.pl, and print to see what it is doing with explicit inputs.


I did notice that you are removing only whitespace from the username. Specifically, you are not removing quote characters from the name.

Consider what happens if $User_Name = " joe's name here ";Then, your

$User_Name= "'" . $User_Name . "'";
Results in 'joe's name here' which has mismatched quotes.

In general, do not filter out bad characters. Instead, only allow good characters. That way if you miss one, you're not hosed.

$User_Name =~ s/[^a-zA-Z0-9]//g;
might be a better choice, or simply s/\D//g; if you want only numbers.


In reply to Re: Specaila characters string not coming in final output file by SuicideJunkie
in thread Specaila characters string not coming in final output file by namishtiwari

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.