in reply to Syntax Problem

You've (accidentally) stumbled upon a new (5.6) feature. Quoting perldoc perldata: ... a literal of the form v1.20.300.4000 is parsed as a string composed of characters with the specified ordinals.

print ".102.111.111 - ", .102.111.111; #prints ".102.111.111 - foo?

This actually parses as:

print ".102.111.111 - ", v0.102.111.111;

Since it's a numeric literal with multiple `.'s, it's interpreted as a v-string (there's actually a hidden \0 there as the first character). In your second example, you don't have a literal with more than two dots, so it parses as print ".$num.111.111 - ",. $num . 111.111.

Replies are listed 'Best First'.
Re: Re: Syntax Problem
by Anonymous Monk on Nov 19, 2001 at 19:40 UTC
    I actually did know about that feature. :) I’d read about it and to experiment, I wanted to print out a table showing the ‘v-string notation, i.e. ‘.102.111.111’, and then the word/symbol that that would result in, i.e. ‘foo’. So I’d have a table like:
    =================
    v-string | output
    =================
     111     |   o
    -----------------
     112     |   p
    -----------------
    
    etc.

    The logical way to achieve this, seemed to be a loop, that printed a line, incremented the count by one, and then printed the next line. This would show me the code and the corresponding letter. However, since I can’t print out .$scalar. I’m not sure how to achieve this...

    Thanks again for your time.

      It'd be no different than your average run-of-the-mill ASCII chart.