I have a class definition:

class Etran {
        has $.dstamp is rw;
        has $.folio is rw;
        has $.ticker is rw;
        has $.qty is rw;
        has $.amount is rw;
        has $.desc is rw;

        method new($line) {
                my ($cmd, $dstamp, $folio, $ticker, $qty, $amount, $way, $desc) 
= shlex-fields $line;
                $!dstamp = $dstamp;
                $!folio = $folio;
                $!ticker = $ticker;
                $!qty = $way == "B" ?? $qty !! - $qty;
                $!amount = $amount;
                $!desc = $desc;
        }

}**
which I instantiate with
        my $e = Etran.new($line);

However, it gives an error message:
        Cannot look up attributes in a Etran type object
at the line
        $!dstamp = $dstamp;

Why that, and how do I fix it?

Also, I don't really understand the difference between using the twigils "." and using 
"!",
and have yet to see an explanation that I understand.

Reply via email to