Perl, open and read [closed]
how to get directory content, and read file in it ?
But i can't use commands and operators that included in this regexp:
/system|[)(\/}{`;,!\\*_]|open|exec|eval/
I think it's a very hard task and i don't known how to make it, please help me.
If this is homework, it's one of the worse questions I've seen, so I'm assuming it's not.
perl -E'say for glob chr 42'
or
perl -e'print qx^ ls ^'
or
perl -MFile::Find::Rule -MMIME::Base64 -E's^^decode_base64 "c2F5IGZvciBGaWxlOjpGaW5kOjpSdWxlLT5tYXhkZXB0aCgxKS0+aW4oJy4nKTs="^ee'
It's really hard because we can't use opendir
or IO::Dir without using ";
" or ",
", can't use File::Find::Rule without using "(
" and ")
", etc.
Is this a homework assignment? If it is, you need to mark it as such.
Perl has commands to open, read, and close a directory.
- To open a directory, you use the opendir.
- To read a name of a file in the directory, you use the readdir command.
- Once you're done, you can use the closedir.
The commands work in a similar fashion as the standard open
, read
, and close
commands.
精彩评论