GaijinPunch has asked for the wisdom of the Perl Monks concerning the following question:
will set the default delimeter to undefined (as opposed to \n). If it is, then my regex is not working like I thought it would.$/ = undef;
Output:#!/usr/bin/perl use strict; use warnings; local $/ = undef; my $info = <DATA>; while ( $info =~ /<tag>(.+?)<\/tag>/g ) { print "$1\n"; } __DATA__ <tag>This is a line</tag> <tag>This one goes over multiple lines</tag> __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: $/ = undef question
by Zaxo (Archbishop) on Jun 28, 2004 at 04:13 UTC | |
by GaijinPunch (Pilgrim) on Jun 28, 2004 at 04:29 UTC | |
|
Re: $/ = undef question
by BUU (Prior) on Jun 28, 2004 at 07:38 UTC | |
by jeffa (Bishop) on Jun 28, 2004 at 19:28 UTC | |
|
Re: $/ = undef question
by skyknight (Hermit) on Jun 28, 2004 at 13:13 UTC |