Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read the end of a script file as a data file (Perl or any other language)

Tags:

shell

ruby

perl

I am looking for the correct syntax of doing the following (in Perl, Shell or Ruby):

# variable to access the data lines appended as a file

END_OF_SCRIPT_MARKER

raw data starts here
and it continues.
like image 388
sina Avatar asked Jul 08 '11 10:07

sina


1 Answers

Perl does this with __DATA__:

#!/usr/bin/perl

use strict;
use warnings;

while(<DATA>)
{
     print;
}

__DATA__
Text to print
goes here
like image 136
ADW Avatar answered Sep 22 '22 11:09

ADW