Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 如何将脚本文件的结尾作为数据文件(Perl或任何其他语言)读取_Ruby_Perl_Shell - Fatal编程技术网

Ruby 如何将脚本文件的结尾作为数据文件(Perl或任何其他语言)读取

Ruby 如何将脚本文件的结尾作为数据文件(Perl或任何其他语言)读取,ruby,perl,shell,Ruby,Perl,Shell,我正在寻找执行以下操作的正确语法(在Perl、Shell或Ruby中): Perl使用\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu来实现这一点: #!/usr/bin/perl use strict; use warnings; while(<DATA>) { print; } __DATA__ Text to print goes here #/usr/bin/perl 严格使用; 使用警告; while() {

我正在寻找执行以下操作的正确语法(在Perl、Shell或Ruby中):


Perl使用
\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
来实现这一点:

#!/usr/bin/perl

use strict;
use warnings;

while(<DATA>)
{
     print;
}

__DATA__
Text to print
goes here
#/usr/bin/perl
严格使用;
使用警告;
while()
{
印刷品;
}
__资料__
要打印的文本
去这里

这是未经授权的版权材料版本。请不要链接到有盗版电子书的网站。@Raoul:谢谢,我不知道它是盗版的!如果有人感兴趣,Ruby中的
\uuuuuu DATA\uuuuuu
等价物是
\uuuu END\uuuuu
,Perl中的
\uuuu END\uuuuuuuuu
\uuuuu数据
同义,因此请使用这两种方法。可能的相关利益:。
#!/usr/bin/perl

use strict;
use warnings;

while(<DATA>)
{
     print;
}

__DATA__
Text to print
goes here