[wellylug] Issues with a perl script

Nic Cave-Lynch nic at tymar.com
Thu Oct 26 14:30:03 NZDT 2006


Anybody ever done any Erlang? I'd be happy to buy coffee in exchange for some 
pointers

Gustav van der Merwe wrote:
> Aww, come on everybody, Haskell, geez.
> 
> On Thu, 2006-10-26 at 14:05 +1300, Phillip Hutchings wrote:
>> Ruby's better :P
>>
>> On 10/26/06, Nic Cave-Lynch <nic at tymar.com> wrote:
>>> Python's good :)
>>>
>>> Geraint M. Jones wrote:
>>>> 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
>>>>
>>>>
>>>
>>> --
>>> Wellington Linux Users Group Mailing List: wellylug at lists.wellylug.org.nz
>>> To Leave:  http://lists.wellylug.org.nz/mailman/listinfo/wellylug
>>>
>>
>> -- 
>> Phillip Hutchings
>> http://www.sitharus.com/
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>>




More information about the wellylug mailing list