Hi,
Is there a way to load a file into an array using a single line of pure perl code? I need something like this, but platform independent:
i can use open, but that is not i'm looking for because its at least 2 lines. I am asking this because i recently came across the "glob" where you can get entire directory listings using <.*>, etc, so mind started wondering if there is something similar for reading files. It'd be so cool to do something like this in perl.
if anybody knows this, please do reply. It doesn't need to be useful, i just want to learn more of these cool hacks in perl!
thanks,
san
---
cheers!
san
print length "The answer to life, universe & everything!
Is there a way to load a file into an array using a single line of pure perl code? I need something like this, but platform independent:
Code:
@data = `cat filename.ext`
#the problem is cat doesn't run on windows, "type" doesn't run on unix
if anybody knows this, please do reply. It doesn't need to be useful, i just want to learn more of these cool hacks in perl!
thanks,
san
---
cheers!
san

print length "The answer to life, universe & everything!