[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] REgular Expression for IP address



On Sat, Feb 12, 2000 at 03:33:54PM +0100, Detlef Lindenthal wrote:
> $IPN =~ s/\./x/g;
> @IPN = split "x", $IPN;
>     ## Sorry for these two lines -- but how could I have split at "."??
>     ## This does not work:  @IPN = split ".", $1;
>     ##      nor does this:  @IPN = split "\.", $1;

The same way you change the periods to Xs.  The first argument to split is
a _regular expression_.

@IPN = split "\\.", $1;   # workable
@IPN = split "\.", $1;    # also workable
@IPN = split /\./, $1;    # PREFERRED

Ronald

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org