Lilian Alvarenga Caravela Godoy wrote:
> 
> Hi everyone
> 
> I am trying to learn Perl looking into some scripts.
> 
> One of them has a regular expression inside.
> 
> First of all, I need to know what two specific lines are doing. The code is
> bellow.
> 
> $req =~ s/\r//g ;

This is replacing all the "\r" characters for "" in the string $req


> $req =~ s/([^\n]{72,72})\n([^\n]{1,71})\n([^\n]{1,71})$/$1\n$2$3/

This can be shortened to:

$req =~ s/(.{72})\n(.{1,71})\n(.{1,71})$/$1\n$2$3/

This searches for three lines where the first line is 72 characters and
the second and third lines are less then 72 characters and removes the
newline character between the second and third lines.



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to