Perl 讀取 JSON 寫法
#!/usr/bin/perl
# apt-get install libjson-perl
# http://search.cpan.org/dist/JSON/# use JSON qw/to_json from_json/;
use JSON;
use Data::Dumper;$json_text = '{"a":1}';
print Dumper from_json($json_text);
# $hash = from_json($json_text);
# print $hash->{'a'} . "\n";
Perl Hello 架構寫法範例
DK 寫 Perl 的標準寫法, 主程式都寫於 main() 中, 整個程式看起來會比較容易懂~ 🙂
註: 此為參考寫法, 並非絕對~
#!/usr/bin/perluse strict;
use warnings;use Data::Dumper;
sub hello
{
my $self = shift;#print Dumper $self;
print "hello, " . $self . "\n";
}sub main
{
hello('test');
}main();
__END__