Perl snippets

Category: /knowledge /development
Tags: development

Get parameters from command line

print $ARGV[0], $ARGV[1] 

Opne/Read a file

open FILE, $fn or die $!;
my $text=join('', <FILE> );
my $total_length=length $text;
print "read file $fn, total size=$total_length";
close FILE;

substring

while ($idx<$total_len){
  print substr $string, $index, $length
}

讨论

提示

  • 如果看不到讨论部分, 请暂时关掉adblock in Firefox/Chrome
  • 本网站使用Javascript实现评论功能, 此处外链对提高您的网站PR没有帮助. (潜台词: 请不要灌水, 谢谢)