did you mean like this when you say ref/deref :

sub resp { $a="abcdefg";\$a } while (${&resp} =~ /(.)/g) { print $1; }
however that goes to an infinitely loop too and for the first time on windows I crash perl interpreter so fast (when i hit Ctrl^C).
sub resp { "abcdefg" } while (&resp =~ /(.)/g) { # you forgot the &,didn't you? print $1; }
in the above code, I expect that &resp returns the 'value' of the subroutine and becomes
while ("abcdefg" =~ /(.)/g) { print $1; }
it would work if it were the case.

so return by ref doesn't work either. what happens in while( &resp =~ /(.)/g ) ??


In reply to Re: Re: Re: Re: Re: backreference question. by Qiang
in thread backreference question. by Qiang

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.