perl 创建包

perl 创建包,第1张

概述zjzc01:/root/big2# cat Employee.pm package Employee;use Data::Dumper;##创建正式雇员sub new_regular { my ($name,$age,$starting_position,$monthly_salary)=@_; my $employee = { "name" =>$name,
zjzc01:/root/big2# cat Employee.pm package Employee;use Data::Dumper;##创建正式雇员sub new_regular {   my ($name,$age,$starting_position,$monthly_salary)=@_;   my $employee = {   "name" =>$name,"age" =>$age,"position" =>$starting_position,"montly_salary" =>$monthly_salary,};  return $employee;  ## 返回对象引用};zjzc01:/root/big2# perl a36.pl Employee.pm dID not return a true value at a36.pl line 3.zjzc01:/root/big2# cat a36.pl unshift(@INC,"/root/big2");require Employee;zjzc01:/root/big2# perl a36.pl Employee.pm dID not return a true value at a36.pl line 3.zjzc01:/root/big2# cat a36.pl unshift(@INC,"/root/big2");require Employee;use Data::Dumper;$var=Employee::new_regular(a,b,c); my $xx= Dumper($var);  print $xx;  print "\n"; print  $var->{name};print "\n";zjzc01:/root/big2# perl a36.pl $VAR1 = {          'position' => 'c','name' => 'a','montly_salary' => undef,'age' => 'b'        };a				
总结

以上是内存溢出为你收集整理的perl 创建包全部内容,希望文章能够帮你解决perl 创建包所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1272354.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-08
下一篇 2022-06-08

发表评论

登录后才能评论

评论列表(0条)

保存