If you have a scenario where you have lots of these arrays floating around and you'd rather not go and change them all to use $array[0], $array[1], you could just put in your code a new function: sub mkdir {CORE::mkdir $_[0],$_[1]} which would then split it up for you.
I'm pretty sure I've read a few times how prototypes are evil, but I think this is even more evil than normal prototypes: with normal prototypes, I can fake my way around them with the & sigil. Not so with built-ins.
(...) No, that doesn't work, either. You have to do both: create the function, AND call it with &. Doesn't work:
Works:$ perl -e '@x=qw(foo 18);sub mkdir{CORE::mkdir($_[0],$_[1])};mkdir(@x) +';ls 2
Also does not work:$ perl -e '@x=qw(foo 18);sub mkdir{CORE::mkdir($_[0],$_[1])};&mkdir(@x +)';ls foo
*sigh* At that point, you may as well call it "MKdir" so it has a different name, and change all your function calls. That's kind of annoying... it's like super-powered evil prototypes.$ perl -e '@x=qw(foo 18);&mkdir(@x)';ls Undefined subroutine &main::mkdir called at -e line 1.
In reply to Re: mkdir with a list variable
by Tanktalus
in thread mkdir with a list variable
by casiano
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |