urgent help needed
I am a beginner in perl and I have a query regarding pattern matching.
I came across a line in perl where it was written
$variable =~ s-/\Z--;
and as the code goes ahead some another variable was assigned
$variable1 =~ s-/--;
can you please tell me what does these 2 lines do?
I want to know what does s-/\Z-- and s-/-- mean.
Thanks & Regards
- Hello Minjal,
This was answered here:
By the way, it is a bad idea to use the word 'urgent' for requests. Not many
people look into such requests.
Alan Haggai Alavi.
The difference makes the difference.
- On 11-07-02 12:48 AM, Minjal Pandejee - ASIC wrote:
> Hi,The first character that follow an s is the delimiter. So the above is
> I am a beginner in perl and I have a query regarding pattern matching.
> I came across a line in perl where it was written
> $variable =~ s-/\Z--;
$variable =~ s/\/\Z//;
The meta-character \Z will match an optional newline and the end of the
string. It is the same as:
$variable =~ s/\/\n?$//;
>It's equivalent would be:
> and as the code goes ahead some another variable was assigned
> $variable1 =~ s-/--;
$variable1 =~ s/\///;
> can you please tell me what does these 2 lines do?
> I want to know what does s-/\Z-- and s-/-- mean.
> Thanks& Regards
> Minjal Pandejee
Just my 0.00000002 million dollars worth,
Confusion is the first step of understanding.
Programming is as much about organization and communication
as it is about coding.
The secret to great software: Fail early & often.
Eliminate software piracy: use only FLOSS.