I'm using windows and taking the paths into a file. An example path is:
M:\O&M Manuals and Databooks\Manual by Job No\Job 9200s\9216\3.0-Manufacturing\3.8-Welding-MTRs\3.8.1-Piping\3.8.1.3-Video-Borescope\3.11.1.3.3-Blowdown-Piping\9216BLDN Weld #10, Detail B.swf
A number of these are in the @titles array.
I've been trying to feed it into a hash with the following code
foreach (@titles) {
my $i=$_;
$i =~ /(.*)?\\(?:.*)?-(.*?)?-(.*)?\\(.*?\#(\d*).*?)?.swf$/i; #used to parse the path
my $who=$4;
my $swffilename = $4;
$swffilename =~ tr{/\.\,\&\# \\s\.}{-};
$swffilename =~ s/--/-/g; # when this is commented out, it works fine but leaves the --
my $part= "$4: num=$5;piping=$2;swffile=$swffilename.swf;jpgfile=$swffilename.jpg";
# $part =~ s/-{2,}/-/ig;
print "$part\n";
my $key;
my $value;
my $rec={};
$titletest{$who} = $rec;
for my $ field (split(/;/,$part)){
($key,$value)= split /=/, $field;
$rec->{$key}=$value;
}
}
Can someone explain why the search and replace causes this to fail?
Thanks,
Shawn
M:\O&M Manuals and Databooks\Manual by Job No\Job 9200s\9216\3.0-Manufacturing\3.8-Welding-MTRs\3.8.1-Piping\3.8.1.3-Video-Borescope\3.11.1.3.3-Blowdown-Piping\9216BLDN Weld #10, Detail B.swf
A number of these are in the @titles array.
I've been trying to feed it into a hash with the following code
foreach (@titles) {
my $i=$_;
$i =~ /(.*)?\\(?:.*)?-(.*?)?-(.*)?\\(.*?\#(\d*).*?)?.swf$/i; #used to parse the path
my $who=$4;
my $swffilename = $4;
$swffilename =~ tr{/\.\,\&\# \\s\.}{-};
$swffilename =~ s/--/-/g; # when this is commented out, it works fine but leaves the --
my $part= "$4: num=$5;piping=$2;swffile=$swffilename.swf;jpgfile=$swffilename.jpg";
# $part =~ s/-{2,}/-/ig;
print "$part\n";
my $key;
my $value;
my $rec={};
$titletest{$who} = $rec;
for my $ field (split(/;/,$part)){
($key,$value)= split /=/, $field;
$rec->{$key}=$value;
}
}
Can someone explain why the search and replace causes this to fail?
Thanks,
Shawn