Re: help me understand $_

2001-04-22 Thread Andy Sharp
Hi, Chris Brown wrote: > i have read about it in 3 books and even used it in scripts i have > made but i still dont truly know how to be sure what $_ contains... > can anyone clear this up for me? Thanks Interesting question, which can be answered in a multitude of ways. The long and the s

Re: help me understand $_

2001-04-22 Thread Andy Sharp
> > Are there performance implications for using the implicit variable ($_) rather > than declaring a specific variable? If so how great ? Yes, though very minimal performance hit if anything. Consider the following: while (chomp(my $line = )) { ... } vs. while ()( ... } According to an exc

Re: My My

2001-04-23 Thread Andy Sharp
The perl documentation (perldoc -f my) has this to say about the perl builtin "my": A my declares the listed variables to be local (lexically) to the enclosing block, file, or eval. If more than one value is listed, the list must be placed in parentheses. See Private Variables via my()

Re: pulling out part of a /path/to/a/file

2001-04-24 Thread Andy Sharp
hi, here's a regex that matches what you're after: $filename =~ m/\/(File-[^\/]+)/; $part_you_want = $1; Simply using negation to match "File-" (and anything which is not a "/") which is preceeded by a "/", is what you want. The trailing / is optional. File::Basename is used to separate the f

Re: Global symbol requires explicit pack name

2001-04-24 Thread Andy Sharp
Hi, The error message you're getting is one of the many changes to the nature of perl under strict. It usually means that the variable in question needs to be either explicitely named (via $::Package::Variable) or lexically scoped (via my, our, or use vars). you've made a couple errors here, w

Re: Displaying blobs on a website

2001-04-26 Thread Andy Sharp
If you're talking about using a database (such as mysql) to store images for later display/perusal on a web page, I believe I can offer a bit of aid. First - it's a bad idea. Databases add a number of layers of overhead for the access of BLOB data as opposed to the filesystem of whatever OS you'

RE: Session Variables

2001-05-08 Thread Andy Sharp
There are many ways to do it, here's mine: I wanted to semi-securely identify users to my site, having them log in once, and then never have the need to login again (as long as they're at the same computer) So, I used cookies (perldoc CGI) to set a unique session ID, once a user had logged in.

RE: Cookies

2001-05-09 Thread Andy Sharp
Cookies are set in the HTTP header portion of the HTML response. When you run you include your script within the page, the HTTP header has already been sent. You need to set the cookie as a standalone page (though you can get cookies in included scripts) --A -Original Message- From: