> 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
> 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
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 --
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
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
> 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
> foreach $i (@a, @b) # did you know you can combine
> arrays like this?
> :)
Oops, darn line wrap, please ignore the smiley...
> > 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.
>
> 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
> 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
> 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 :)
[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', '
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
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
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
15 matches
Mail list logo