[wellylug] Issues with a perl script

Geraint M. Jones G.Jones at french-maid.co.nz
Thu Oct 26 10:28:34 NZDT 2006


I have the following script from a book (about windows & linux
intergration)

#!/usr/bin/perl -w
my $line;
mkdir(/profiles/, 0755);
open(USERS, "/usr/bin/getent passwd|");
while ($line = <USERS>) {
        my ($name, $password, $uid, $gid) = split(/\:/, $line);
        if ($name !~ /^[\w\ \-\+]+$/) {
                next;
        }
        if (-e "/profiles/$name") {
                next;
        }
        if (($uid =~ /^\d+$/) && ($gid =~ /^\d+$/))
        {
                mkdir("/profiles/$name", 0700);
                chown($uid, $gid, /profiles/$name);
        }
}
close(USERS);

however it fails with the following errors

[root at ella ~]# ./makeprofile.pl
Scalar found where operator expected at ./makeprofile.pl line 16, near
"/profiles/$name"
        (Missing operator before $name?)
syntax error at ./makeprofile.pl line 16, near "/profiles/$name"
Execution of ./makeprofile.pl aborted due to compilation errors.

Unfortunately I know no perl - anyone see any glaring problems with it ?

G


--
This e-mail and any attached files are confidential and may be legally privileged. If you are not the addressee, any disclosure, reproduction, copying, distribution, or other dissemination or use of this communication is strictly prohibited. If you have received this transmission in error please notify the sender immediately and then delete this mail.

E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission or changes to transmitted date not specifically approved by the sender.

If this e-mail or attached files contain information which do not relate to our professional activity we do not accept liability for such information.

This email has been scanned for all currently known viruses by Proxmox v1.5




More information about the wellylug mailing list