Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

don't know how to write array

Status
Not open for further replies.

tiercel

IS-IT--Management
Dec 4, 2001
3
0
0
US
I'm trying to write a program to change permissions on the mail folders. I found a pre-written program that should accomplish this but am just learning Perl. This is my questionable code:
my ($file, %perms, $account, $mask, @rights);
foreach $file (@ARGV) {
next unless -e $file ; # make sure if exists
if (Win32::FileSecurity::Get( $file, \%perms ) ) {
What the hell is @ARGV and how do I write the array? Thanks for any help!
 
@ARGV contains the Arguments Given at the command line.

[tt]perl myscript.pl argument1 argument2[/tt]

The arguments here are argument1 and argument2

I don't know if you can modify this array.
 
No, from what I have read in the Camel book, you can't modify the array. You might be able to in Perl 6, it should be awesome.

-Vic
 
@ARGV is the list of command line parameters, so if you have a script called t.pl and call it like this:

t.pl you me someone

$ARGV[0] contains 'you'
$ARGV[1] contains 'me'
$ARGV[2] contains 'someone'

Actually -- you *can* modify @ARGV, though I don't think that's what you want to do, I think that understaning the command line thing will sort you out.

Just for interests sake, here's an example of modifying @ARGV, this fragment here:

print "$ARGV[0]\n";
$ARGV[0]='AAARRGGHH';
print "$ARGV[0]\n";

in a file called t.pl, run it like this

t.pl you

it prints

you
AAARRGGHH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top