Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: Re: Re[3]: How's your Perl?

by tachyon (Chancellor)
on Oct 27, 2003 at 08:29 UTC ( [id://302358]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re[3]: How's your Perl?
in thread How's your Perl?

I agree that it was not what was expected but it does fulfill the criteria as stated. The answer was probably supposed to be this as noted elsewhere:

$[ The index of the first element in an array, and of the first character + in a substring. Default is 0, but you could theoretically set it to +1 to make Perl behave more like awk (or Fortran) when subscripting an +d when evaluating the index() and substr() functions. (Mnemonic: [ be +gins subscripts.) As of release 5 of Perl, assignment to $[ is treated as a compiler dir +ective, and cannot influence the behavior of any other file. --> Its +use is highly discouraged :-) $[ = 1; $x[0] = 1; show(); $x[0] = 2; show(); $x[1] = 3; show(); sub show { print "\$x[$_] = $x[$_]\n" for 0..$#x; }

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Replies are listed 'Best First'.
Re: Re: Re: Re: Re[3]: How's your Perl?
by Juerd (Abbot) on Oct 27, 2003 at 08:33 UTC

    Yes, the answer was probably supposed to be this as noted elsewhere

    As noted in the reply to that elsewhere, it's not the solution we were looking for. So if you're not all to disappointed yet, to achieve real insanity, try to find another solution.

    Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

Re[7]: How's your Perl?
by xmath (Hermit) on Oct 27, 2003 at 10:06 UTC
    I agree that it was not what was expected but it does fulfill the criteria as stated.

    No, as juerd pointed out, you're not changing $x[0] nor $x[1]: they both remain equal to \$_. All you show is that if you change ${$x[0]} then ${$x[1]} changes, which wasn't the exercise.

    Note that I have no problem with unexpected solutions — I love the $[ one.. didn't think of that — but they do need to be valid.   :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://302358]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2024-04-23 08:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found