Perl Programming/Keywords/pos

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Previous: pop Keywords Next: print

The pos keyword[edit | edit source]

pos returns the offset of the last m//g search left off for the variable in question. If no variable is passed, $_ is used instead. 0 is a valid match offset. An undef indicates that the search position is reset. This may occur due to a match failure or no match has yet been run on this scalar.

Syntax[edit | edit source]

  pos SCALAR
  pos

See also[edit | edit source]

Previous: pop Keywords Next: print