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

Re^2: Scripting Help

by Anonymous Monk
on Dec 14, 2015 at 19:48 UTC ( [id://1150270]=note: print w/replies, xml ) Need Help??


in reply to Re: Scripting Help
in thread Scripting Help

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.

Replies are listed 'Best First'.
Re^3: Scripting Help
by mr_ron (Chaplain) on Dec 14, 2015 at 20:40 UTC

    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
Re^3: Scripting Help
by poj (Abbot) on Dec 14, 2015 at 20:32 UTC
    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.
        Does your code have the line use strict; ?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-26 00:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found