Over a million developers have joined DZone.

Perl: Dirify String

DZone's Guide to

Perl: Dirify String

· ·
Free Resource
Clean up a string for creation of a directory named using the string.

my $dir = dirify('The s^#%@$!#! title ever');     # outputs 'The-S-Title-Ever'

sub dirify {
    my $s = shift;

    $s =~ s!<[^>]+>!!gs;            # Remove HTML tags.
    $s =~ s!

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}