> This was all written by a vendor and I am trying to learn
> PERL to modify what they did. When you say I must print it
> explicitly, what exactly do you mean?
You have to _sort_ it explicitly. In Timothy's example, he was sorting
the hash alphabetically based on the keys. The keys function r
Thanks for the info! Here is a code snippet we are using to process the
array:
sub ViewError( % )
{
if( $MAIN::FUNCTION != $MAIN::F_NOTHING )
{
if ( $MAIN::SOURCE == $MAIN::S_ERROR || $MAIN::SOURCE ==
$MAIN::S_BOTH)
{
$Err207Flag = "N"; ## P. Starkey 10/12/2000
That's not the way associative arrays work. They are stored differently.
If you want them to be printed in a certain order, then you must do it
explicitly. I think it is really better to think of it as a hash instead of
an associative array for that reason. Not all of the rules apply. I
commo
Hi,
not directly. But do st. like:
@foo = "some string";
@new_foo = split(//,$foo[0]);
now you can access $new_foo[6]
Not very witty but useful ;-)
At 10:14 AM 8/14/01 -0700, Eric Wang wrote:
>Hi guys,
>
>Got a quick question.
>If I let @foo = "some string";
>can I access say the "t" in this st
At 11:12 AM 8/14/01 -0700, you wrote:
>Hi Peter,
>Can you be more specific?
>so I can use $foo = "string";
>and then what?
Then you type "perldoc -f substr" to learn about the substr function. You
should see something like this, which contains all the information you need
plus examples:
An associative array is the old name for a hash, which isn't what you're using.
At 10:14 AM 8/14/01 -0700, Eric Wang wrote:
>Hi guys,
>
>Got a quick question.
>If I let @foo = "some string";
>can I access say the "t" in this string by using $foo[6] ?
You've got a scalar which you want to treat a
Short answer: Yes.
Medium answer: Sort of, but they need to references to arrays not arrays
Long answer:
A hash (common term for associative array) contains a scalar key and a
scalar value. A scalar value can be (not inclusive) a number, a string,
or a reference. Since we can generate a refer