Remember: the value of $/ is a string, not a regex.
The difference between your two 'assignment' statements is that the first one is actually an assignment (Assignment Operators) and the second is a logical test (Equality Operators). The result of the first is assigning $/ the result of a (probably) failed regular expression, which is "". The second is a test in void context, and thus does not change the value of $/ - it remains "\n". In short, it doesn't work that way and using warnings would have told you as much.
Given that you've already constructed a regular expression, your easiest/fastest solution would be to slurp the files and use the regular expression in a while loop:
#!/usr/bin/perl use strict; use warnings; local $/; $_ = <DATA>; while (m/(.+?(?:$|(?=\d{4}\-\d{2}\-\d{2}\s+\d{1,2}\:\d{1,2}\:\d{1,2})) +)/gs) { print "START${1}END\n"; } __DATA__ 2010-03-11 18:26:42,431 DEBUG 5 System 172.22.2.120 (null) asdfasd fas +fdsdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asd fasd fasdf asdf asdf asdf as dfasdf 2010-03-11 18:26:42,431 DEBUG 9 System 172.22.2.120 (null)asdf asdf as +df asdf asdf asdf asdf asd fasdfaf as fasdf asdf asdf as df asdf asdf adsf sdf asdf a fasdf asdf asdfdf af 2010-03-11 18:26:42,431 DEBUG 8 System 172.22.2.120 (null)asdf asdf as +df asdf asdf asdf asfasdfasf asf asdf asdf asdf asd fasdf asdf asdf asdf asdf asdfasf asdf asdf
In reply to Re: PERL $/variable
by kennethk
in thread PERL $/variable
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |