02-28-2011
Quote:
Originally Posted by
yifangt
Thanks!
I got it now, but it seems to me if there is duplicate items in either of the arrays, it won't work, right?
Correct. That's why I said "assuming each array contains only unique values".
The
union will work anyway (it's a
union, not
union all).
This User Gave Thanks to radoulov For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a little problem. To keep a configuration simple, I've exceeded my perl knowledge. :-) I've worked with multi-dimentional arrays before, but this one has me beat:
@info = (
{
'defval' => 'abc'
'stats' = (
{ 'name' => 'a', },
{ 'name' =>... (1 Reply)
Discussion started by: jsmoriss
1 Replies
2. Shell Programming and Scripting
Hi,i have a code fragment below.
%tag = (); #line 1
$tag{'info'} = $datastring; #line 2
$resp = $ua->request( #$ua is a user agent
POST 'http://10.2.3.0' ,
Content_Type => application/x-www-form-urlencoded
Content => #line 3 I am not sure of what the code... (3 Replies)
Discussion started by: new2ss
3 Replies
3. Shell Programming and Scripting
suppose my @{$data1{$callid}}; cotains
one two three
three five six
one two three
of random patterns but each item is separated by white space or tab,
Below code extract and get rid of the whitespace perfectly so that it shows now like this
onetwothree
threefivesix... (2 Replies)
Discussion started by: hankooknara
2 Replies
4. Shell Programming and Scripting
Hi all experts,
May I know how to read a csv file and read the content in a hash in PERL?
Currently, I hard-coded and defined it in my code. I wanna know how to make up the %mymap hash thru reading the cfg.txt
====
csv file(cfg.txt):
888,444
999,333
===
#!/usr/bin/perl
my... (1 Reply)
Discussion started by: kinmak
1 Replies
5. Shell Programming and Scripting
Hi ,
I have an input.txt file that i read
node: id= c1, class=nb, cx=100, cy=100, r=10
node: id=c2, class=b, cx=150, cy=130, r=10
node: id=c3, class=nb, cx=50, cy=80, r=10
node: id=c4, class=nb, cx=120, cy=200, r=10
i split over , and = to create a global array and then passed it to a... (6 Replies)
Discussion started by: rsanjay
6 Replies
6. Shell Programming and Scripting
I have 2 arrays:
@array1 outputs the following:
1
1
1
2
@array2 outputs the following
A
B
C
D (2 Replies)
Discussion started by: streetfighter2
2 Replies
7. Shell Programming and Scripting
Hi guys
I have this part of a perl script that returns and odd error
if ($args{software}) {
print " @DISTFILE_GROUPS $output->{distfile_groups}->{ get_rdist_groups}\n";
and the error is
Can't coerce array into hash at
i've never seed this error before, any ideas
thanks... (0 Replies)
Discussion started by: ab52
0 Replies
8. Shell Programming and Scripting
How do I get the unique hashes from an array of hashes?
@ar1 = ( {a=>1,b=>2}, {c=>3,d=>4},{a=>1,b=>2});I need :
@ar2 = ( {a=>1,b=>2}, {c=>3,d=>4});Thanks. (2 Replies)
Discussion started by: shellwell
2 Replies
9. Programming
Hi All
I have been using a curl code to output an hash that looks like this
$VAR1 = {
'data'... (5 Replies)
Discussion started by: ab52
5 Replies
10. Programming
Sorry for the “word salad” subject, but I wanted to cast a wide net for help.
I've created an IP (Internet Protocol) server which serves HTTP, SMTP, and FTP requests.
As you probably know, they all require creating a socket, listening on it, accepting connections, and then having a short... (3 Replies)
Discussion started by: John S.
3 Replies
BIND(1) General Commands Manual BIND(1)
NAME
bind, mount, unmount - change name space
SYNOPSIS
bind [ option ... ] new old
mount [ option ... ] servename old [ spec ]
unmount [ new ] old
DESCRIPTION
Bind and mount modify the file name space of the current process and other processes in the same name space group (see fork(2)). For both
calls, old is the name of an existing file or directory in the current name space where the modification is to be made.
For bind, new is the name of another (or possibly the same) existing file or directory in the current name space. After a successful bind,
the file name old is an alias for the object originally named by new; if the modification doesn't hide it, new will also still refer to its
original file. The evaluation of new (see intro(2)) happens at the time of the bind, not when the binding is later used.
The servename argument to mount is the name of a file that, when opened, yields an existing connection to a file server. Almost always,
servename will be a file in /srv (see srv(3)). In the discussion below, new refers to the file named by the new argument to bind or the
root directory of the service available in servename after a mount. Either both old and new files must be directories, or both must not be
directories.
Options control aspects of the modification to the name space:
(none) Replace the old file by the new one. Henceforth, an evaluation of old will be translated to the new file. If they are directo-
ries (for mount, this condition is true by definition), old becomes a union directory consisting of one directory (the new file).
-b Both files must be directories. Add the new directory to the beginning of the union directory represented by the old file.
-a Both files must be directories. Add the new directory to the end of the union directory represented by the old file.
-c This can be used in addition to any of the above to permit creation in a union directory. When a new file is created in a union
directory, it is placed in the first element of the union that permits creation.
The spec argument to mount is passed in the attach(5) message to the server, and selects among different file trees served by the server.
The srv(3) service registry device, normally bound to /srv, is a convenient rendezvous point for services that can be mounted. After boot-
strap, the file /srv/boot contains the communications port to the file system from which the system was loaded.
The effects of bind and mount can be undone with the unmount command. If two arguments are given to unmount, the effect is to undo a bind
or mount with the same arguments. If only one argument is given, everything bound to or mounted upon old is unmounted.
EXAMPLES
To compile a program with the C library from July 16, 1992:
mount /srv/boot /n/dump dump
bind /n/dump/1992/0716/mips/lib/libc.a /mips/lib/libc.a
mk
SOURCE
/sys/src/cmd/bind.c
/sys/src/cmd/mount.c
/sys/src/cmd/unmount.c
SEE ALSO
bind(2), open(2), srv(3), srv(4)
BIND(1)