[Chapter 15] 15.9 Conversion Functions
Author: Stephen Spainhour and Valerie Quercia
Date: Fri Aug 29 18:13:06 1997

#

| Chapter 15 Perl Quick Reference |

## 15.9 Conversion Functions

`chr` expr(dagger)

  Returns the character represented by the decimal value expr.

`gmtime` expr(dagger)

  Converts a time as returned by the `time` function to a 9-element array (0:$sec, 1:$min, 2:$hour, 3:$mday, 4:$mon, 5:$year, 6:$wday, 7:$yday, 8:$isdst) with the time analyzed for the Greenwich time zone. $mon has the range 0..11 and $wday has the range 0..6.

`hex` expr(dagger)

  Returns the decimal value of expr interpreted as a hex string.

`localtime` expr(dagger)

  Converts a time as returned by the `time` function to ctime(3) string. In array context, returns a 9-element array with the time analyzed for the local time zone.

`oct` expr(dagger)

  Returns the decimal value of expr interpreted as an octal string. If expr starts off with 0x, interprets it as a hex string instead.

`ord` expr(dagger)

  Returns the ASCII value of the first character of expr.

`vec` expr, offset, bits

  Treats string expr as a vector of unsigned integers, and yields the bit at offset. bits must be between 1 and 32. May have a value assigned to it.

Arithmetic Functions |  | Structure Conversion