Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Scripting Help

by RichardK (Parson)
on Dec 14, 2015 at 19:19 UTC ( [id://1150267]=note: print w/replies, xml ) Need Help??


in reply to Scripting Help

In what way doesn't it work? do flames shoot out of the back of your computer or something else?

Try the basic debugging checklist for some general help on how to fix anything.

Also you could try checking the return values from the system calls.

or step through it one line at a time in the debugger.

Replies are listed 'Best First'.
Re^2: Scripting Help
by Anonymous Monk on Dec 14, 2015 at 19:48 UTC
    Sorry I have been so frustrated with it after working on it for 6 hours lol. The issue I get for adding a group is: Can't use string ("Test2") as a HASH ref while "strict refs" in use at ./example3 line 35, <> line 2. The error I get for deleting a group that I made previously in an earlier class, I get: Can't use string ("Test") as a HASH ref while "strict refs" in use at ./example3 line 44, <> line 2.

      In two places you repeat the code:

      my $group_name = get_input("Enter Group Name: "); if ( exists $group_name->{$group_name} ) {

      The sub get_input() returns a string which, as the error messages are telling you, you are trying to use as hash reference with exists. On the left side of the -> arrow $group_name is a hash reference and on the right side of the arrow it is a string and key to the hash. It looks like in read_doc you need to create a hash of groups and return a reference to it.

      Ron
      For the code you posted I get
      Global symbol "$group_id" requires explicit package name .. Global symbol "$choice" requires explicit package name ..
      poj
        explicit package name as in /etc/group? The choice is made prior to that, it only throws up after I add my groups name.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1150267]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-19 21:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found