Thread: What is $' ?

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    0
    Rep Power
    0
    Can anyone tell me what $' means in the following script?

    if ($datearray[0] =~m/#/){
    $datearray[0] = $';
    }

    Most of the rest I can either understand or find in my Perl book but not this one.

    Cheers for *any* inspiration
    Trev
  2. #2
  3. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    Ft. Lauderdale, FL, US
    Posts
    29
    Rep Power
    0
    its for postmatch.

    its the string following what matched in the regex.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Posts
    452
    Rep Power
    14
    for example:

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    $string = 'my name is Bert';
    $string =~ m/my name is /;
    print $';

    #prints "Bert";

    [/code]

IMN logo majestic logo threadwatch logo seochat tools logo