Linuxtrent: Re: Corso Perl

  • From: <matteoianeselli@xxxxxxxxxxx>
  • To: linuxtrent@xxxxxxxxxxxxxxxxx
  • Date: Sun, 1 Apr 2001 10:05:17 +0200

Guido Brugnara writes:
 > 
 > Allego il piccolo esempio argomento della precente = 
 > lezione per gli interessati.

Rieccolo in versione "sana" (per via del quoted printable)
----------------------------------------------------------------------

#!/usr/bin/perl -w

use IO::File;

$fh = new IO::File;
$fh->open("< /etc/passwd") or die "Errore apertura file\n";

while(<$fh>) {

  my($user,$passwd,$uid,$gid,$comments,$home,$shell) = split /:/,$_,7;

  print STDOUT " user=$user\n" .
               "  psw=$passwd\n" . 
               "  uid=$uid\n" .
               "  gid=$gid\n" .
               " comm=$comments\n" . 
               " home=$home\n" .
               " shell=$shell\n\n";

}

$fh->close;
-- 
Matteo Ianeselli  
matteoianeselli AT poboxes.com
-- 
Per iscriversi  (o disiscriversi), basta spedire un  messaggio con SOGGETTO
"subscribe" (o "unsubscribe") a mailto:linuxtrent-request@xxxxxxxxxxxxxxxxx


Other related posts: