You're pushing in the values completely wrong.
In this case @str contains only one element, "karnataka,tamilnadu,bihar,mumbai", because qw uses whitespace to split the single elements. So either lose the qw, or replace the commas with a single space character. This also applies to @str1 of course.
I have line which is read from xml doc. I want to put this line into hash(perl variable). find line below and how i want to put this in hash
<font size="10" type="int" name="ABC" >
hash key should be size, type and name with corresponding value
I doing as below:-
$line =~ s/\s*.*?\s//;... (3 Replies)
i want to ask is it i can use hash in perl to store a page number with a list of words which is in that page and then print it out?
Example
Page 1 contains a are boy cat ............. (a list of sorted words)
how can i store it in a hash?
Thank you (3 Replies)
This is my data
1 0
1 0
1 1
1 2
1 6
1 7
Assume that first field is key and 2nd field is value
I want to create a hash in perl, on this data. My hash should having uniq key and all values by , separated.
1,0,0,1,2,6,7
1 will be my key and rest of are should be values. (3 Replies)
Hi i am reading one file and creating Hash from the contents of it my issue is there are 3 different files in 3 different locations having same structure so for parsing these files i have one subroutine which returns hash after reading all the 3 files i need to create consolidated hash from three... (2 Replies)
Can Someone explain me why even using Tie::IxHash I can not get the output data in the same order that it was inserted? See code below.
#!/usr/bin/perl
use warnings;
use Tie::IxHash;
use strict;
tie (my %programs, "Tie::IxHash");
while (my $line = <DATA>) {
chomp $line;
my(... (1 Reply)
Hi,
In Perl, is it possible to use a range of numbers with '..' as a key in a hash?
Something in like:
%hash = (
'768..1536' => '1G',
'1537..2560' => '2G'
);
That is, the range operation is evaluated, and all members of the range are... (3 Replies)
Hi ,
i have the below code its working fine when i execute in unix , but its not working in windows could you pls explain me where i am going wrong.
This is the program
$data = { '1' => 'one' ,
'2' => 'two' ,
3 => 'three'
};
print "hello : $data->{'1'}... (2 Replies)
Hi,
I have an hashes of hash, where hash is dynamic, it can be n number of hash. i need to compare data_count values of all .
my %result (
$abc => {
'data_count' => '10',
'ID' => 'ABC122',
}
$def => {
'data_count' => '20',
'ID' => 'defASe',
... (1 Reply)
My issue is that the perl script (as I have done it so far) created empty branches when I try to check some branches on existence.
I am using multydimentional hashes: found it as the best way for information that I need to handle. Saing multidimentional I means hash of hashes ... So, I have
... (2 Replies)
Discussion started by: alex_5161
2 Replies
LEARN ABOUT DEBIAN
ns_nextword
Ns_String(3aolserver) AOLserver Library Procedures Ns_String(3aolserver)__________________________________________________________________________________________________________________________________________________NAME
Ns_Match, Ns_NextWord, Ns_StrCaseFind, Ns_StrCopy, Ns_StrDup, Ns_StrNStr, Ns_StrToLower, Ns_StrToUpper, Ns_StrTrim, Ns_StrTrimLeft, Ns_Str-
TrimRight, Ns_StringPrint, ns_strcopy, ns_strdup - library procedures
SYNOPSIS
#include "ns.h"
char *
Ns_Match(char *a, char *b)
char *
Ns_NextWord(char *line)
char *
Ns_StrCaseFind(char *s1, char *s2)
char *
Ns_StrCopy(char *str)
ns_strcopy(char *str)
char *
Ns_StrDup(char *str)
ns_strdup(char *str)
char *
Ns_StrNStr(char *pattern, char *expression)
char *
Ns_StrToLower(char *string)
char *
Ns_StrToUpper(char *string)
char *
Ns_StrTrim(char *string)
char *
Ns_StrTrimLeft(char *string)
char *
Ns_StrTrimRight(char *string)
void
Ns_StringPrint(char *string)
_________________________________________________________________DESCRIPTION
Ns_Match(a, b)
Compare the beginnings of two strings, case insensitively. The comparison stops when the end of the shorter string is reached.
Return NULL if no match, b if match.
Ns_NextWord(line)
Return a pointer to first character of the next word in a string; words are separated by white space. The returned pointer points
into the original string. For example, Ns_NextWord("abc def") returns a pointer to the 'd' in that string.
Ns_StrCaseFind(s1, s2)
Locate the first occurrence of substring s2 within string s1 in a case-insensitive manner. The terminating ' ' characters are not
compared. Returns a pointer that points into s1. Uses strstr(3) to do its work.
Ns_StrCopy(str)
ns_strcopy(str)
Copy a string or NULL value using Ns_Malloc. The Ns_StrCopy function is identical to the Ns_StrDup function but allows for the
string parameter to be NULL, in which case Ns_StrCopy does nothing and returns NULL.
Ns_StrDup(str)
ns_strdup(str)
Copy a string using Ns_Malloc. The Ns_StrDup function calls Ns_Malloc to allocate enough memory to make a copy of the given string.
Ns_StrNStr(pattern, expression)
Search through pattern for expression, case insensitively. Return a pointer that points to where the match begins within pattern, or
NULL if expression is not contained in pattern.
Ns_StrToLower(string)
Convert string to lowercase. Returns pointer to original string. Original string will be modified.
Ns_StrToUpper(string)
Convert string to uppercase. Returns pointer to original string. Original string will be modified.
Ns_StrTrim(string)
Trim leading and trailing white space from string. A pointer to the trimmed string will be returned, which will be in the original
string. Do not lose your original pointer to the string if you later need to free it.
Ns_StrTrimLeft(string)
Trim leading white space from string. A pointer to the trimmed string will be returned, which will be in the original string. Do not
lose your original pointer to the string if you later need to free it.
Ns_StrTrimRight(string)
Trim trailing white space from string. The original string pointer will be returned, but the string will have been modified: a ' 's
will have been placed right after the last non-whitespace character of the string.
Ns_StringPrint(string)
Print a string to stdout.
SEE ALSO nsd(1), info(n)
KEYWORDS AOLserver 4.0 Ns_String(3aolserver)