Skip to content

Instantly share code, notes, and snippets.

@nilskoppelmann
Created December 23, 2013 20:16
Show Gist options
  • Save nilskoppelmann/8103880 to your computer and use it in GitHub Desktop.
Save nilskoppelmann/8103880 to your computer and use it in GitHub Desktop.
Perl Equivalent to PHP's nl2br
#!/usr/bin/perl
use strict;
use warnings;
sub nl2br {
my $t = shift || return;
$t =~ s/([\r])/<br>/g;
return $t;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment