perl中的语法

前端之家收集整理的这篇文章主要介绍了perl中的语法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在哪里可以找到有关perl中以下语法的更多信息?

< DATA>之间的连接和__DATA__不清楚.

while (my $date_string = <DATA>) {
  chomp($date_string);
  next if not length $date_string;
  print "$date_string ist Unixtime ",$lang_date->str2time($date_string)," und ",$lang_date->time2str( '%d.%m.%Y %T (%Z)',$lang_date->str2time($date_string) ),"\n";
}

__DATA__
1.3.1999
1 Marz 1999
1. Marz 1999
1/3/1999

解决方法

报价 the doc

The __DATA__ token tells the perl compiler that the perl code for
compilation is finished.

Everything after the __DATA__ token is
available for reading via the filehandle FOOBAR::DATA
,where FOOBAR is
the name of the current package when the __DATA__ token is reached.

This works just the same as __END__ does in package ‘main’,but for
other modules data after __END__ is not automatically retrievable,
whereas data after __DATA__ is.

可以添加到这一点,只有使用__DATA__部分是非常方便的来说明Perl中的一些文件阅读相关概念.它基本上是附加到代码文件,并且可以通过< DATA>容易地访问该文件内容.这就是为什么它在这里很受欢迎. )

原文链接:https://www.f2er.com/Perl/172753.html

猜你在找的Perl相关文章