Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Re: Encoding wonders

by srawls (Friar)
on Jun 13, 2001 at 04:52 UTC ( #87973=note: print w/replies, xml ) Need Help??

in reply to Re: Encoding wonders
in thread Encoding wonders

Humm, it works on my Sun Solaris 5.7. Make sure that the first line is not blank, this should appear before any new lines:
die unless print keys %j and open uc sqrt hex chr lstat;
If that doesn't work, I'll try to see what else might be wrong.

Update: Oh yeah, Perl version 5.005

The 15 year old, freshman programmer,
Stephen Rawls

Replies are listed 'Best First'.
Re: Encoding wonders
by dimmesdale (Friar) on Jun 14, 2001 at 21:49 UTC
    Works for me (Sun Solaris 5.7).
    #First line, does as you said; #uc sqrt hex chr lstat evals to 0, and open w/ string #appends $ in front, so it opens $0, aka, yourself die unless print keys %j and open uc sqrt hex chr lstat; #~~<0>; 0 is the filehandle, so it reads in one line #...the two negations(~~) cancel each other out, by the way #You assign to @_, ignoring q, y, i, x, d, ;, and % #(since, I presume, they aren't in the string you print out) @_[0..100] = grep{!/[qyixd;%]/}split//,~~<0>; #Simple enough, set output sep., to rec. sep, i.e., \n $\=$/; #Here's where the magic takes place. print substr join( #First, you map the @_ array that you assigned to for #values 0..46; you sort them w/ z sub, dereferencing them #And then you map them, again dereferencing $&, map{$$_[$[]} sort{z($$a[1])<=>z($$b[1])} map{[$_[$_],$_]}0..46),23; #This function (taking your ref. to ref. to match, divided # by ref. to ref. to ref. to match plus 1..$=, i.e., 1..60 #You've arranged it so as to pop the values you need to to #get the correct result; It's difficult to figure out at #first glance, however, so I'll leave it for someone else #to inform us of. sub z {@h[18,28,6,12,13,20,3,23,33,35,0,10,1,9,5,32,4,8,39,45, 29,14,15,40]= (1+\\///\\\//..$=);$h[pop];}
      Works for me (Sun Solaris 5.7).

      If and only if you execute the code in one particular way. The day after I complained about this particular JAPH, I discovered that it would only work if run as perl japh. In your node, you explained why:

      so it opens $0
      I should have read his node more carefully, it also contains a strong hint regarding how it has to be run.
      I don't understand why it opens itself. Why does opening "a string" append a $ and then treat it as a variable?
        From the perlfunc::open section of the site(aslo the perl manpages):
        If EXPR is omitted, the scalar variable of the same name as the FILEHANDLE contains the filename.
        That means that if an open is called like open 0 then 0 is the filehandle, and the "scalar variable" to open. Take, for instance, this example from perlfunc::open:
        $ARTICLE = 100; open ARTICLE or die "Can't find article $ARTICLE: $!\n"; while (<ARTICLE>) {...
        If your asking why, as in why is it that way, I'd presume its for brevity and ease, as in:
        $LOG = '/path/to/log/file/'; open LOG;

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2023-02-06 06:26 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (33 votes). Check out past polls.