Data segment: Difference between revisions

Content deleted Content added
AndrijaSt (talk | contribs)
mNo edit summary
Make clear link is for Ruby
 
(One intermediate revision by the same user not shown)
Line 46:
 
==Interpreted languages==
Some interpreted languages offer a similar facility to the data segment, notably [[Perl]]<ref>[http://perldoc.perl.org/perldata.html#Special-Literals perldata: Special Literals]</ref> and [[Ruby (programming language)|Ruby]].<ref>Ruby: ObjectEmbedded Data: [httphttps://docs.ruby-doclang.org/docsen/keywordsmaster/1.9/Objectglobals_rdoc.html#methodlabel-i-__END__ __END__Embedded+Data]</ref> In these languages, including the line <code>__DATA__</code> (Perl) or <code>__END__</code> (Ruby, old Perl) marks the end of the code segment and the start of the data segment. Only the contents prior to this line are executed, and the contents of the source file after this line are available as a file object: <code>PACKAGE::DATA</code> in Perl (e.g., <code>main::DATA</code>) and <code>DATA</code> in Ruby. This can be considered a form of [[here document]] (a file literal).
 
==See also==