in reply to (jeffa) Re: Obfuscation: program seeing own source
in thread Obfuscation: program seeing own source
But why does seek(DATA,0,0); go to the start of the file, not the start of __DATA__ ?
andy.
update: so it's a handle for the script itself... on disk, presumably, rather than in memory? shame.
versus#!/usr/bin/perl -w use strict; print "foo\n"; seek(DATA,0,0); while (<DATA>) { s/foo/bar/ and ! /eval/ and eval ; } __DATA__
#!/usr/bin/perl -w use strict; print "foo\n"; seek(DATA,0,0); my @me = <DATA> ; foreach (@me) { s/foo/bar/ and ! /eval/ and eval ; } foreach (@me) { s/bar/baz/ and ! /eval/ and eval ; } __DATA__
|
|---|