Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Re: Re: Re: checking the end of line

by I0 (Priest)
on Jul 19, 2002 at 23:35 UTC ( #183507=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Re: checking the end of line
in thread checking the end of line

For a string 'stuff_here_then_12' ($path =~ /(\d+)$/)[0] captures the 12

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: checking the end of line
by dimmesdale (Friar) on Jul 20, 2002 at 14:04 UTC
    $1 captures 12, you are right. However, you do an array slice thing with the [0] part -- which on my machine perl 5.6.1 AS build 633 produces an error; I have to move the parentheses around the regex itself. And when you print it, it shows a 1 on my computer. I just don't see the need for the [0]
      What error does it produce on your machine? On mine, the array slice is necessary to put the regex in list context so that it returns the captured string instead of the true or false value it returns in scalar context
        Syntax error becuase of )[

        With the parens around JUST the regex it works (but returns a 1).

        Assigning the results to an array or using the $1 variable, however, would get around this if the user is having any problems ...

        Has anyone else been having problems with PM? I checked my firewall, and it seems that the banners up top keep 'timing-out', so the whole page takes forever to load.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://183507]
[1nickt]: ( Sometimes when idle I browse remote corners of the code repo at $work ... usually this yields knowledge of projects to decline and coworkers to avoid ... )
[LanX]: sure
[Corion]: 1nickt: Finding autobox in production would give me pause, yes
[LanX]: efficient survey
[MidLifeXis]: And under MINGW64_NT-6.1 MYHOST 2.6.0(0.304/5/3) 2016-09-09 09:46 x86_64 Msys there seem to be issues with escapes in external build tool calls.
[Corion]: I mean, it's a technical feat it achieves, but... why? ;)
[MidLifeXis]: And it also has the 0.14 version of the tarball in its manifest.
[LanX]: avoiding unreadable brackets
[MidLifeXis]: Although the previous one could be a b0rken PATH, I would need to dig for that.
[thezip]: I've got to go to meetings now. If anyone has further comments regarding Spreadsheet::XLSX deployment to Strawberry Perl 5.24.1, please /msg me -- thanks!

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2017-03-23 17:24 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (291 votes). Check out past polls.