in reply to Most efficient way to remove some text from a string
With some guessing (and fixing what I think is a typo)
#!/usr/bin/perl # http://perlmonks.org/?node_id=1177327 use strict; use warnings; my $prefixlength = length '/Volumes/WD/Not Migrating/Music/'; while(<DATA>) { substr $_, 0, $prefixlength, ''; my $indent = tr#/##; print " " x $indent, "* $_"; } __DATA__ /Volumes/WD/Not Migrating/Music/Ana Tijoux /Volumes/WD/Not Migrating/Music/Ana Tijoux/Luchin /Volumes/WD/Not Migrating/Music/Ana Tijoux/Luchin/Luchin.m4a
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Most efficient way to remove some text from a string
by adamZ88 (Beadle) on Dec 06, 2016 at 21:23 UTC | |
by tybalt89 (Monsignor) on Dec 06, 2016 at 22:29 UTC | |
by adamZ88 (Beadle) on Dec 07, 2016 at 00:57 UTC | |
by Marshall (Canon) on Dec 07, 2016 at 02:36 UTC | |
by tybalt89 (Monsignor) on Dec 07, 2016 at 01:34 UTC | |
by adamZ88 (Beadle) on Dec 07, 2016 at 20:09 UTC | |
| |
by RonW (Parson) on Dec 08, 2016 at 22:56 UTC | |
by hippo (Archbishop) on Dec 09, 2016 at 09:35 UTC |