in reply to Re: Unidentified code
in thread Unidentified code

Also, I was wondering how you would go about getting information out of this:  print "$main::objbase->[155] = sub { my $i = item->new('FILLABLE', 1, 'NAME', 'an empty vial', 'VAL', 10, 'VOL', .5, 'MASS', .5, 'DESC', 'A simple glass vial, about three inches long. There is a bit of cork stuffed into the opening to help protect any liquids that may be placed inside.'); return($i); };\n";

Replies are listed 'Best First'.
Re: Re: Unidentified code
by Chmrr (Vicar) on Oct 22, 2001 at 05:36 UTC

    Let's reformat the code to be a little more readable:

    $main::objbase->[155] = sub { my $i = item->new('FILLABLE'=> 1, 'NAME'=>'an empty vial', 'VAL'=>10, 'VOL'=>.5, 'MASS'=>.5, 'DESC'=>'A simple glass vial, about three in +ches long. There is a bit of cork stuffed into the opening to help pr +otect any liquids that may be placed inside.' ); return($i); };

    Looked at this way, it's a little easier to see what's going on. First, off, there's this scalar in package main named objbase, which we'll treat as an array reference. Item number 155 of that array we're going to set to an anonymous subroutine. This subroutine makes a new "item" object, passing it a bunch of key=>value pairs. It'll then return the objevt that it just created.

    Thus, the way you'd use this would probably be:

    $vial = $main::objbase->[155]();

    perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^+*`^ ve^#$&V"+@( NO CARRIER'