Leonid Grinberg wrote: >> You don't have to escape the colon in a regular expression. > > Oh, cool. Didn't know that. > >> > my $home = $split_line[5]; >> > my @split_home = split(/\/, $home); >> ^^^ >> Syntax error. The terminating delimiter is missing. > > I am confused. What do you mean, the terminating delimter is missing? > It seems alright to me...
$ perl -ce'split /\/, "one/two"' Bareword found where operator expected at -e line 1, near "/\/, "one/two" (Missing operator before two?) String found where operator expected at -e line 1, at end of line (Missing semicolon on previous line?) syntax error at -e line 1, near "/\/, "one/two" Can't find string terminator '"' anywhere before EOF at -e line 1. $ perl -ce'split /\//, "one/two"' -e syntax OK The backslash escapes the character following it. >> "scalar(@split_home) - 1" could also be written as "$#split_home" or >> just "-1". > > I did not know that ``-1'' would work. However, I prefer scalar() to $#. Using scalar() there is redundant as the expression is already in scalar context. Also using "scalar(@split_home) - 1" will not work correctly if the value of $[ has been changed. John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/