# Perl

To use this language, use the class "language-perl".

## Comments

    # Single line comment
    =head1 Here There
    	Be Pods!
    =cut

## Strings

    q/foo bar baz/;
    q awhy not ?a;
    qw(foo bar baz) q{foo bar baz}
    q[foo bar baz] qq<foo bar baz>
    "foo bar baz" 'foo bar baz' `foo bar baz`

## Regex

    m/foo/ s/foo/bar/
    m zfooz s zfoozbarz
    qr(foo) m{foo} s(foo)(bar) s{foo}{bar}
    m[foo] m<foo> tr[foo][bar] s<foo><bar>
    /foo/i

## Variables

    ${^POSTMATCH}
    $^V
    $element_count = scalar(@whatever);
    keys(%users) = 1000;
    $1, $_, %!;

## Numbers

    12345
    12345.67
    .23E-10 # a very small number
    3.14_15_92 # a very important number
    4_294_967_296 # underscore for legibility
    0xff # hex
    0xdead_beef # more hex
    0377 # octal (only numbers, begins with 0)
    0b011011 # binary

## Full example

    sub read_config_file {
      my ($class, $filename) = @_;

      unless (defined $filename) {
        my $home  = File::HomeDir->my_home || '.';
        $filename = File::Spec->catfile($home, '.pause');

        return {} unless -e $filename and -r _;
      }

      my %conf;
      if ( eval { require Config::Identity } ) {
        %conf = Config::Identity->load($filename);
        $conf{user} = delete $conf{username} unless $conf{user};
      }
      else { # Process .pause manually
        open my $pauserc, '<', $filename
          or die "can't open $filename for reading: $!";

        while (<$pauserc>) {
          chomp;
          next unless $_ and $_ !~ /^\s*#/;

          my ($k, $v) = /^\s*(\w+)\s+(.+)$/;
          Carp::croak "multiple enties for $k" if $conf{$k};
          $conf{$k} = $v;
        }
      }

      return \%conf;
    }

## Known failures

There are certain edge cases where Prism will fail. There are always such cases in every regex-based syntax highlighter. However, Prism dares to be open and honest about them. If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.

### Comment-like substring

    "test # test";

### Comment symbol in regexp

    /test#test/;

### Two quotes of the same type (i.e. both single or both double) inside a regex

    /"foo"/;