Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

don't know how to write array

don't know how to write array

don't know how to write array

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 is @ARGV and how do I write the array?  Thanks for any help!

RE: don't know how to write array

@ARGV contains the Arguments Given at the command line.

perl myscript.pl argument1 argument2

The arguments here are argument1 and argument2

I don't know if you can modify this array.

RE: don't know how to write 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.


RE: don't know how to write array

@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";
print "$ARGV[0]\n";

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

t.pl you

it prints


Cargill's Corporate Web Site

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close