Here is my code.

The problem is that your code does not compile under strictures (the  use strict; statement; see strict). If  use strict; is left out and the code is run under warnings alone (the  use warnings; statement), Perl produces a bunch of warnings about uninitialized values and possible typos, warnings you should ponder well. Also take a look at the rules for interpolation discussed in the Quote and Quote-like Operators section of perlop; a careful Reading of this section of The Fine Manual would repay your effort. (Same as  perldoc perlop from the command line.)

Here is an example of double-quote interpolation and single-quote non-interpolation. (These examples have been given before by others.) An example is also given of entering a string from the command line at a prompt. Note that once successfully entered, 'interpolating' characters do not interpolate further: Perl does not do multi-level or nested interpolation. Perhaps you can build on something like this example to demonstrate the problem(s) you are facing. (Note: I use  qq{double quotes} rather than  "double quotes" on my Windoze command line so that the code will not be cluttered by irruptions of backslashes.)

>perl -wMstrict -le "my $def = 'hi there'; my @jkl = qw(foo bar); ;; my $str1 = qq{abc$def}; my $str2 = qq{ghi@jkl}; ;; print qq{str1: :$str1:}; print qq{str2: :$str2:}; ;; my $str3 = 'pqr$def'; my $str4 = 'xyz@jkl'; ;; print qq{str3: :$str3:}; print qq{str4: :$str4:}; ;; ;; print 'enter password: '; my $pw = <STDIN>; chomp $pw; ;; print qq{pw: :$pw:} " str1: :abchi there: str2: :ghifoo bar: str3: :pqr$def: str4: :xyz@jkl: enter password: open@sez$me pw: :open@sez$me:

In reply to Re^3: Need help in while entering password by AnomalousMonk
in thread Need help in while entering password by anandooty

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.