Hi, I am trying to use struct as an argument of a function. In the piece of code I try to use $t as a parameter of the print_usage function but it gives the error:
Can't call method "ru_stime" without a package or object reference at str.txt l ne 28. Could anyone explain what is wrong? thanks oznur use Class::Struct; struct( rusage => { ru_utime => timeval, # seconds ru_stime => timeval, # microseconds }); struct( timeval => [ tv_secs => '$', tv_usecs => '$', ]); my $t = new rusage; $t->ru_utime->tv_secs(100); $t->ru_utime->tv_usecs(0); $t->ru_stime->tv_secs(5); $t->ru_stime->tv_usecs(0); &print_rusage($t); sub print_rusage{ my $r=new rusage; [EMAIL PROTECTED]; print $r->ru_stime->tv_secs; }