Skip to Content
Perl in a Nutshell, 2nd Edition
book

Perl in a Nutshell, 2nd Edition

by Nathan Patwardhan, Ellen Siever, Stephen Spainhour
June 2002
Beginner
759 pages
80h 42m
English
O'Reilly Media, Inc.
Content preview from Perl in a Nutshell, 2nd Edition

Name

write

Synopsis

$fh->write (buf, len[, offset])

Like write found in C; that is, the opposite of read. The wrapper for the Perl write function is format_write.

IO::Handle also provides the following methods, which are not described in detail here because they are simply frontends for the corresponding built-in functions. See Chapter 5 for more information.

Method

Description

close

Closes file or pipe

eof

Returns 1 if next read will return end-of-file

fileno

Returns file descriptor for a filehandle

getc

Returns next character from input file

print

Prints a string or comma-separated list of strings

printf

Prints a formatted string

read

Reads data from a filehandle

stat

Returns an array of status information for a file

sysread

Reads data from a filehandle with system call read(2)

syswrite

Writes data to a filehandle with system call write(2)

truncate

Truncates a file to a specified length

Finally, the following methods act on the equivalent Perl variables. See Chapter 4 for more information.

Method

Description

autoflush

If nonzero, forces a flush now and after each write or print (default 0)

format_page_number

Current page number

format_lines_per_page

Current page length (default 60)

format_lines_left

Number of lines left on page

format_name

Name of current report format

format_top_name

Name of current top-of-page format

format_line_break_characters

Current set of linebreak chars for a format

format_formfeed

Formfeed char used by formats (default \f)

format_write

Wrapper for write

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Perl in a Nutshell

Perl in a Nutshell

Nathan Patwardhan, Ellen Siever, Stephen Spainhour
Programming Perl, 3rd Edition

Programming Perl, 3rd Edition

Larry Wall, Tom Christiansen, Jon Orwant

Publisher Resources

ISBN: 0596002416Errata Page