RE: interview question

2001-04-19 Thread Nutter, Mark
> can someone pl tell me what is the best ans to the interview question > > "what is tie ?" In 25 words or less, "Tie lets you attach custom functionality to a scalar, hash, or array." Common uses of tie include mapping a hash or an array to a database table so that you can create/search/update

RE: CGI problem

2001-04-19 Thread Nutter, Mark
> Am testing out a new web server running SunOS5.8 " and I > can't get any of my cgi scripts to run. I get this error message: > "Premature end of script headers" > > the cgi scripts worked perfectly on the old server which was running Digital UNIX. In general this means your script died befor

RE: how to execute a windows 2000 command with perl

2001-04-19 Thread Nutter, Mark
You should be able to use system() for Windows calls that don't return results, or backticks (``) for calls that do return results. Be aware that if you specify absolute Windows paths (`dir C:\win2000\system32`), you may have problems with the backslash being interpreted as an escape character --

RE: Debug message

2001-04-19 Thread Nutter, Mark
Maybe you have a missing dollar sign in front of a variable name? What's on line 123 of your script? > -Original Message- > From: Michael Mitchell [mailto:[EMAIL PROTECTED]] > Sent: Thursday, April 19, 2001 4:02 PM > To: [EMAIL PROTECTED] > Subject: Debug message > > > Remembering how

Stupid Hash Tricks

2001-04-20 Thread Nutter, Mark
Here's some real basic info about hashes...may be useful to newbies... @ary = ('a', 'b', 'c', 'b', 'a'); %hsh = (); # empty hash foreach $item (@ary) { $hsh{$item} = 1; } @ary = keys %hsh; What does @ary contain now? You can think of a hash as being like an array that is indexed by st

RE: Use Strict

2001-04-20 Thread Nutter, Mark
> What does exactly does use strict do? Here's a sample: use strict; use vars qw( $a $b $c # this is how you declare variables $myvar ); # for use with "use strict" $a = 1; #ok $b = 2; #ok $c = $a + b; #oops, forgot $ in fro

RE: Stupid Hash Tricks

2001-04-20 Thread Nutter, Mark
> foreach $i (@a, @b) # did you know you can combine > arrays like this? > :) Oops, darn line wrap, please ignore the smiley...

RE: Use Strict

2001-04-20 Thread Nutter, Mark
> > use strict; > > > > use vars qw( $a $b $c # this is how you declare variables > >$myvar ); # for use with "use strict" > > I've always seen it done this way: > > #[code] > my ($a, $b, $c, $myvar); > #[/code] > > ...so that the variables are part of the current package. >

RE: DBI and ORACLE

2001-04-20 Thread Nutter, Mark
> My results are in a comma delimited file. I need to read > through the file > adding each line as a record in the table using the SQL: > > my $query1=<<"QUERY"; > INSERT INTO DIFFAMNTS VALUES > ('PK',9197,171509,'THIS IS A TEST2 > ROW','AA',1,77120,101032) > QUERY > > Obviously

RE: Stupid Hash Tricks

2001-04-20 Thread Nutter, Mark
> Ok I know what it does ('cause I ran it, see below) but I > still don't fully > understand how. Well, it's a trick, based on the "givens" that neither array contained any duplicates. If each item appears at most once per array, then all we need to do is count the number of times each item a

RE: Header files dilemma!

2001-04-23 Thread Nutter, Mark
> I hope this helps, and don't forget to read: > > perldoc perlmod > perldoc perlmodlib > perldoc constant > perldoc Exporter Ooo, a bibliography at the end of the specific advice -- that's a *great* idea for a beginners list. We should make that a convention :)

RE: DBI and ORACLE

2001-04-23 Thread Nutter, Mark
[Copying the list on a reply to a private email, with permission] A placeholder consists of a single question mark ("?") in your query statement. It replaces a single value in your SQL statement. For example: Without placeholders: INSERT INTO MYTABLE VALUES ('Mark', 'Nutter', 'foo', 'bar', '

RE: void context, looping example

2001-04-25 Thread Nutter, Mark
Line 9 says else { $num * 3; $num++; } The expression "$num * 3" is in a void context. In other words, it calculates a value, but doesn't assign that value to anything. I think the most likely typo is a missing equals sign: else { $num *= 3; $num++; } ^ This would

RE: replacing an element in an array

2001-04-27 Thread Nutter, Mark
Others have given you some good stuff about deleting from the array, but what about if you try a different approach and filter the files as you add them to the array? #!/usr/local/bin/perl $file = 'flashimage.txt'; # file name @lines = ();# init empty array open(INFO, $file) or

Komodo

2001-04-27 Thread Nutter, Mark
Some of you may be interested in Komodo... http://www.activestate.com/ASPN/ It's a GUI IDE for Perl (and Python and other unmentionables :). The "Visible Regex" stuff is pretty cool for playing around. You have to join ActiveState Programmers Network (ASPN), but it's free, and comes with a fre