Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Scripting Help

by RichardK (Parson)
on Dec 14, 2015 at 19:19 UTC ( #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.

      For the code you posted I get
      Global symbol "$group_id" requires explicit package name .. Global symbol "$choice" requires explicit package name ..
        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?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2020-05-26 18:31 GMT
Find Nodes?
    Voting Booth?
    If programming languages were movie genres, Perl would be:

    Results (150 votes). Check out past polls.