The read Function (fread)
#Format
#read(FILEHANDLE, SCALAR, LENGTH, OFFSET);
#read(FILEHANDLE, SCALAR, LENGTH);
open(PASSWD, "/etc/passwd") || die "Can't open: $!\n";
$bytes=read (PASSWD, $buffer, 50);
print "The number of bytes read is $bytes.\n";
print "The buffer contains: \n$buffer";
Related examples in the same category