in reply to Re^3: How to use __DATA__ efficiently, help!
in thread How to use __DATA__ efficiently, help!
If you don't bother to tell DATA; ahead of time and instead just seek DATA, 0, 0;, then you effectively print "hello world\n`cat $0`" which isn't what you're expecting.#!/usr/bin/perl use strict; use warnings; my $data_start = tell DATA; print while (<DATA>); seek DATA, $data_start, 0; print while (<DATA>); __DATA__ hello world
Is this the best solution to the original poster's problem? Nope. Is it a solution to "how do I re-process this normal filehandle?" Yep.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: How to use __DATA__ efficiently, help!
by Anonyrnous Monk (Hermit) on Feb 10, 2011 at 17:32 UTC |