Copyright © tutorialspoint.com

# PERL s/// Function

## Syntax

s/PATTERN/REPLACE/

## Definition and Usage

Not a function. This is the regular expression-substitution operator. Based on the regular expression specified in PATTERN, data is replaced by REPLACE. Like m//, the delimiters are defined by the first character following s.

## Return Value

- 0 on failure

- Number of substitutions made on success

## Example

    #!/usr/bin/perl -w

    $string = "This is Test";
    # this will replcase Test with Best.
    $string =~ s/Test/Best/;

    print "$string\n";

It will produce following results:

    This is Best

Copyright © tutorialspoint.com