Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Perligata array indices

by msh210 (Monk)
on Jun 28, 2016 at 16:44 UTC ( [id://1166805]=perlquestion: print w/replies, xml ) Need Help??

msh210 has asked for the wisdom of the Perl Monks concerning the following question:

I can't get Perligata array indices to work: it uses the index instead of the array value. Here's my code, with # comments where the result is unexpected:

adnota -MLingua: +:Romana::Perligata ute strict. ute warnings. adnota use stric +t; use warnings; huic vestibulo perlegementum da. adnota $_ = read +line STDIN; his lacunam tum hoc scindementa da. adnota @_ = spli +t ' ', $_; meis apis lacunam tum hoc scindementa da. adnota my @ap = +split ' ', $_; meo io nullum da. adnota my $i=0; meo mo haec admetamentum da. adnota my $m = $ +#_; per in nullum tum mum conscribementis fac sic adnota for (0..$ +m) { hoc tum lacunam egresso scribe. adnota print S +TDOUT $_, ' '; hoc horum tum lacunam egresso scribe. adnota print S +TDOUT $_[$_], ' '; # prints $_ instead cis adnota } scribe novumversum egresso. adnota print STD +OUT $/; meis bis. adnota my @b; meo vo. adnota my $v; per vum in nullum tum mum conscribementis fac sic adnota for $v (0 +..$m) { vum tum lacunam egresso scribe. adnota print S +TDOUT $v, ' '; vum aporum tum lacunam egresso scribe. adnota print S +TDOUT $ap[$v]; # prints $v instead vo borum vum aporum da. adnota $b[$v] += $ap[$v]; # doesn't assign adnota + # (@b has a 'once' warning, not on adnota + # this line, in simpler versions of adnota + # this script) cis adnota } scribe novumversum egresso. adnota print STD +OUT $/; per in his fac sic scribe hoc tum lacunam egresso cis adnota for (@_) +{print STDOUT $_, ' '} scribe novumversum egresso. adnota print STD +OUT $/; per in bis fac sic scribe hoc egresso cis adnota for (@b) +{print STDOUT $_} # doesn't print

Can anyone help, please?

$_="msh210";$"=$\;@_=@{[split//,uc]}[2,0];$_="@_$\1";$\=$/;++$_[0]for$...1;print lc substr crypt($_,"@_"),1,6

Replies are listed 'Best First'.
Re: Perligata array indices
by TheDamian (Vicar) on Jul 02, 2016 at 04:01 UTC
    Did you try:
    use Lingua::Romana::Perligata 'converte';
    at the start of the program, to be shown precisely how it's converting the Latinate code to Perl?

    When I do that on your source under Perl 5.20, I get (after perltidy-ing it):

    use strict; use warnings; $_ = Lingua::Romana::Perligata::getline(*STDIN); @_ = split( " ", $_ ); my (@ap) = split( " ", $_ ); my $i = 0; my $m = Lingua::Romana::Perligata::__lastelem__(@_); for $_ ( Lingua::Romana::Perligata::__enlist__( 0, $m ) ) { print( STDOUT $_, " " ); print( STDOUT $_[$_], " " ); } print( STDOUT "\n" ); my (@b); my $v; for $v ( Lingua::Romana::Perligata::__enlist__( 0, $m ) ) { print( STDOUT $v, " " ); print( STDOUT $ap[$v], " " ); $b[$v] = $ap[$v]; } print( STDOUT "\n" ); for $_ (@_) { print( STDOUT $_, " " ) } print( STDOUT "\n" ); for $_ (@b) { print( STDOUT $_ ) }
    which appears to be exactly equivalent to your comments on the right.

    If 'converte' produces the same code for you, then that's literally what Perligata is actually executing.

    If it doesn't produce the same code, then it's a puzzle (maybe related to the version of Perl and/or Perligata you're using?)

      Nope, I get:

      use strict ; use warnings ; $_ = IO::Handle::getline (*STDIN ); @_ = split ( " ", $_); my (@ap ) = split ( " ", $_); my $i = 0; my $m = Lingua::Romana::Perligata::__lastelem__ ( @_); for $_ (Lingua::Romana::Perligata::__enlist__ ( 0, $m)) {print (STDOUT + $_, " "); print (STDOUT $_, " ")} ; print (STDOUT "\n"); my (@b ); my $v ; for $v (Lingua::Romana::Perligata::__enlist__ ( 0, $m)) {print (STDOUT + $v, " "); print (STDOUT $v, " "); $v = $v} ; print (STDOUT "\n"); for $_ (@_) {print (STDOUT $_, " ")} ; print (STDOUT "\n"); for $_ (@b) {print (STDOUT $_)}

      Note that I'm running perl 5, version 20, subversion 2 (v5.20.2) built for MSWin32-x64-multi-thread and use Lingua::Romana::Perligata 9999999999999 tells me this is only version 0.50.

      $_="msh210";$"=$\;@_=@{[split//,uc]}[2,0];$_="@_$\1";$\=$/;++$_[0]for$...1;print lc substr crypt($_,"@_"),1,6
        Hmmmm. Might be time for another release.

        Could you email me privately, and I'll send you an alpha that you can try out before I upload it to CPAN?

Re: Perligata array indices
by Anonymous Monk on Jun 28, 2016 at 21:18 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-18 02:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found