# man > Email::Simple::Header(3pm)

---
type: CommandReference
command: Email::Simple::Header
mode: perldoc
section: 3pm
source: perldoc
---

## Quick Reference

- `Email::Simple::Header->new($head, \%arg)` — create a header object from a string
- `$header->as_string()` — return the header as a string
- `$header->header_names()` — list unique header field names
- `$header->header_raw($field)` — get value(s) of a field
- `$header->header_raw_set($field => @values)` — set or remove a field
- `$header->header_raw_prepend($field => $value)` — add a field at the beginning
- `$header->header_raw_pairs()` — list all field/value pairs in order
- `$header->crlf()` — get the newline string used in the header

## Name

**Email::Simple::Header** — the header of an Email::Simple message

## Synopsis

perl
my $email = Email::Simple->new($text);
my $header = $email->header_obj;
print $header->as_string;
## Description

This module implements the headers of an Email::Simple object. It is a minimal interface, mostly for internal use.

## Methods

- `new($head, \%arg)` — $head is a string containing a valid email header (or a reference to one). Optional arg: `crlf` (default CRLF). If a reference is passed, it may be altered.
- `as_string(\%arg)` — returns a stringified version of the header.
- `header_names` — returns a list of unique header names in no particular order.
- `header_raw_pairs` — returns a list of all field/value pairs in order of appearance. (Do not assign to a hash because some fields may repeat.)
- `header_pairs` — alias for `header_raw_pairs` (older name). Prefer `header_raw_pairs` for clarity.
- `header_raw($field, $index?)` — in scalar context, returns the first value of the field; with an index, returns the nth value; in list context, returns all values. Returns false if the field does not exist.
- `header($field)` — calls `header_raw`. This is the older name; in Email::MIME this method returns the decoded value.
- `header_raw_set($field => @values)` — updates the value of an existing header in place, or adds a new header at the end. If no values are given, the header is removed.
- `header_set` — alias for `header_raw_set` (older name). Prefer `header_raw_set` for clarity.
- `header_raw_prepend($field => $value)` — adds a new instance of the named field as the first field in the header.
- `crlf` — returns the newline string used in the header.

## See Also

- [Email::Simple](https://metacpan.org/pod/Email::Simple)
- [Email::MIME](https://metacpan.org/pod/Email::MIME)