[oclug]Really basic Perl help

B McKee b_mckee at myrealbox.com
Sat Jan 4 16:40:02 EST 2003


I'm sure I am the most confused one here :-)

The result I really want is  "Varous text I want"

The result I was hoping for was "Three Various text I want \n Three"

----  Assuming this is contents of data.txt
Line One with stuff
Line Two with other stuff
Line Three Various text I want
Three

One of the reasons I'm confused is I want to look at the file as a whole 
rather than a series of lines.  My other choice seems to be @a, but that just 
gives me an array, which isn't what I want either.

In truth I want to be able to read in an HTML file and output a subsection 
that is framed with a specific <--! Comment -->  
I gather their may be a module that would help, but I thought my needs could 
be handled by a simple regular expression search.  Since this will end up on 
someone else's server I didn't want to have to install any extra software to 
make it work.


On January 4, 2003 03:54 pm, you wrote:
> * B McKee <b_mckee at myrealbox.com> [030104 13:20]:
> > Can somebody take a look at this and explain the results to me?  I'm
> > obviously not reading this documentation right...  Please keep in mind
> > I'm no programmer...
>
> I am confused as to what you are thing to accomplish with
>
> 	while (<DATA>) {
> 	$a = $a.( /Three/../Three/ ) ;
> 	}
>
> The line tests to see if the string "Three" is a substring of the line
> just read from <DATA> (ie the $_ string).  If not present then nothing
> is appended to the $a, since ( () .. () ) produces an empty string.  If
> the "Three" substring is matched then the ( 1 .. 1 ) would be appended
> to the $a string, but I would expect this to produce "1" not "1E0"...
>
> 1E0 is 1 (in engineering notation), but am not sure why.
>
> So, again, what are you trying to do?
>
> B.



More information about the OCLUG mailing list