perl的helloworld

http://zhidao.baidu.com/question/177283266.html

http://www.vim.org/scripts/script.php?script_id=556

apple:Desktop apple$ cat test.pl 
#!/usr/bin/perl
use strict;
use warnings;
print "Hello,
 world\n";
print 
"Hello,world\n"
;

my $animal = "camel";
my $answer = 42;
print "The animal is $animal\n";
print "The square of $answer is ", $answer * $answer, "\n";
print;

my @animals = ("camel", "llama", "owl");
my @numbers = (23, 42, 69);
my @mixed = ("camel", 42, 1.23);

print $mixed[$#mixed]; 
print "\n";
print @animals[0,1]; # gives ("camel", "llama");
print "\n";
print @animals[0..2]; # gives ("camel", "llama", "owl");
print "\n";
print @animals[1..$#animals]; # gives all except the first element
print "\n";

print "sort---\n";
my @sorted = sort @animals;
print @sorted[0..$#sorted];
#my @backwards = reverse @numbers;
#print @backwords[0..$#backwords];
apple:Desktop apple$

cp*.zip~/.vim/

unzip*.zip

vim下:helptags~/.vim/doc

否则help不好使

:hperlsupport

破玩意,没用明白。破帮助,装完之后vim*.pl竟然报错

这个说得好像很有道理,但是国内好像被墙了,郁闷了

http://blog.csdn.net/cityeremite/archive/2009/09/08/4533547.aspx

ftp://mirrors.sohu.com/CPAN/

-----------------cat----

#!/usr/bin/perl
while($line=<>){
        print ($line);
}

--------------

#!/usr/bin/perl 
if(!-e "/root/Desktop/perl/test"){
        print STDERR ("file test is not exists.");
}else{
        if(open(MYFILE,"/root/Desktop/perl/test")){
                $line=<MYFILE>;
                @array= <MYFILE>;
                print $line;
                print @array;
        }
}

-------------------mylocalour*-------------

#!/usr/bin/perl
&testsub;
sub testsub{
        print "this is a sub named 'testsub'\n\n";
}

@testarray=("aa","bb","cc");
&sub1(@testarray);
sub sub1{
        my(@list) = @_;
        print @list,"\n";
        @list=("b","k");
        print @list,"\n";
}
print @testarray,"\n\n";

$foo=26;
&testsub1(*foo);
sub testsub1{
        local(*printarray)=@_;
        print $printarray,"\n";
        $printarray=61;
}
print $foo,"\n\n";

相关推荐