S
Sam Denton
OK, my first post had a bug, but it's a real problem, honest.
Here's my (fixed!) code:
+208 chomp ($fsmount);
+209 $fsmount .= ' ';
+210
+211 print "*** fsmount = \"$fsmount\"";
+212 print ", empty" if $fsmount eq "";
+213 print ", undef" unless defined($fsmount);
+214 print " ***\n";
+215
+216 # if ( $fsmount =~ m=^/= ) {
+217 # $fsmount =~ s/:.*$//;
+218 my $firstchar = substr($fsmount,0,1);
+219 if ( $firstchar eq '/' ) {
+220 $fsmount =~ s/:.*//;
When I run this code with '-w', here's what I see:
# perl unix_replica.pl
*** fsmount = " " ***
Use of uninitialized value in pattern match (m//) at unix_replica.pl
line 218.
*** fsmount = "/: " ***
*** fsmount = " dev = /dev/hd4 " ***
Use of uninitialized value in pattern match (m//) at unix_replica.pl
line 218.
*** fsmount = " vol = "root" " ***
Use of uninitialized value in pattern match (m//) at unix_replica.pl
line 218.
Line 209 guarantees that there's at least one character in $fsmount,
so the 'substr($fsmount,0,1)' should always return one character
string. Everything works just fine without the '-w' option. Any ideas?
Here's my (fixed!) code:
+208 chomp ($fsmount);
+209 $fsmount .= ' ';
+210
+211 print "*** fsmount = \"$fsmount\"";
+212 print ", empty" if $fsmount eq "";
+213 print ", undef" unless defined($fsmount);
+214 print " ***\n";
+215
+216 # if ( $fsmount =~ m=^/= ) {
+217 # $fsmount =~ s/:.*$//;
+218 my $firstchar = substr($fsmount,0,1);
+219 if ( $firstchar eq '/' ) {
+220 $fsmount =~ s/:.*//;
When I run this code with '-w', here's what I see:
# perl unix_replica.pl
*** fsmount = " " ***
Use of uninitialized value in pattern match (m//) at unix_replica.pl
line 218.
*** fsmount = "/: " ***
*** fsmount = " dev = /dev/hd4 " ***
Use of uninitialized value in pattern match (m//) at unix_replica.pl
line 218.
*** fsmount = " vol = "root" " ***
Use of uninitialized value in pattern match (m//) at unix_replica.pl
line 218.
Line 209 guarantees that there's at least one character in $fsmount,
so the 'substr($fsmount,0,1)' should always return one character
string. Everything works just fine without the '-w' option. Any ideas?