How can I use __DATA__ twice?

后端 未结 3 1259
耶瑟儿~
耶瑟儿~ 2020-12-25 12:09

How can I use __DATA__ twice?

#!/usr/local/bin/perl
use warnings;
use 5.012;

while (  ) {
    print;
}

while (  ) {
           


        
3条回答
  •  隐瞒了意图╮
    2020-12-25 12:49

    In all honesty, the easiest solution is to read DATA once and stash it in an array or variable.

    my @data;
    while(){
      push @data, $_;
    }
    

提交回复
热议问题