• MORE:
  • Perl Camel
  • rss
  • GitHub logo
Perl.com
  •   ABOUT
  •   AUTHORS
  •   CATEGORIES
  • #
      TAGS

How to read a string into an array of characters using split

Oct 3, 2013 by David Farrell

development
string
array
split

Perl’s split function has a useful feature that will split a string into characters. This works by supplying an empty regex pattern (“//”) to the split function. This can be used to easily split a word into an array of letters, for example:

Read it

Execute Perl code stored in a text file with eval

May 28, 2013 by David Farrell

development
filehandle
string
syntax
wizardry
eval

Runtime abitrary code execution

Read it

List shortcuts: qw the quote whitespace operator

Apr 9, 2013 by David Farrell

development
operator
string
array
syntax

A popular way to build a list of literal quotes in Perl is to use the quote whitespace operator (qw). It’s terse, versatile and elegant. To see why, let’s look at a typical statement using a list of strings:

Read it

Upgrade your list printing using field separator variables

Apr 3, 2013 by David Farrell

development
string
variable
scalar
array
syntax

A typical way to print every element of an array in Perl is using a foreach loop:

Read it

Repeat strings with the repetition operator Repeat strings with the repetition operator

Apr 2, 2013 by David Farrell

development
operator
string

You get the idea - Perl has a repetition operator (x) that repeats the scalar or list on its left by the number on it’s right (like multiplication).

Read it

Perl string functions - concatenate substring and split

Mar 31, 2013 by David Farrell

development
operator
string
syntax

Perl has many string functions, let’s take a look at a some of the most common ones: concatenate, substring and split.

Read it

Quoting strings in Perl - even ones containing apostrophes and quote or speech marks

Mar 30, 2013 by David Farrell

development
operator
string
variable

Broadly speaking Perl has two types of strings: quotes that are interpolated at runtime and literal quotes that are not interpolated. Let’s review each of these in turn.

Read it

Beginner's Introduction to Perl 5.10, Part 2

May 7, 2008 by chromatic and Doug Sheppard

tutorials
files
perl-5-10
perl-filehandles
string
tutorials

A Beginner’s Introduction to Perl 5.10 talked about the core elements of Perl: variables (scalars, arrays, and hashes), math operators and some basic flow control (the for statement). Now it’s time to interact with the world. (A Beginner’s Introduction…

Read it
Page 1 of 1
Site Map
  • Home

  • About

  • Authors

  • Categories

  • Tags

Contact Us

To get in touch, send an email to perl.com-editor@perl.org, or submit an issue to perladvent/perldotcom on GitHub.

Perl Camel rss GitHub logo

License

This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.

Creative Commons License

Legal

Perl.com and the authors make no representations with respect to the accuracy or completeness of the contents of all work on this website and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. The information published on this website may not be suitable for every situation. All work on this website is provided with the understanding that Perl.com and the authors are not engaged in rendering professional services. Neither Perl.com nor the authors shall be liable for damages arising herefrom.