07-14-2008
'unshift' adds to the beginning of an array, 'push' adds to the end of an array.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
The way I've been using arrays currently have been:
#!/bin/ksh
set -A myArray
myArray=value1
myArray=value2
myArray=value3
myArray=value4
Is there a way I can assign values to an array that will automatically place the value into the next element in the array like:
myArray=value1... (4 Replies)
Discussion started by: yongho
4 Replies
2. Shell Programming and Scripting
hi every body,
i donot know how to assign a array varible with a file
see i having file
more file
property1 Name
property2 Address
the above two line are tab Space seperated between the property and its value
i want to seperate it and assign to... (1 Reply)
Discussion started by: kkraja
1 Replies
3. Shell Programming and Scripting
Just wondering if there's a better way to get these complete sentences into an array and keep the quotes intact? All the quotes make it look ugly to me but it works. I want to be able to refer to the full sentences by index. I've tried a few qw and qq/ aproaches but what I have below seems about... (4 Replies)
Discussion started by: gctaylor
4 Replies
4. Shell Programming and Scripting
I need to do something like this:
for i in 1 2 3 4 5; do
arr=$(awk 'NR="$i" { print $2 }' file_with_5_records)
done
That is, parse a file and assign values to an array in an ascending order relative to the number of record in the file that is being processed on each loop.
Is my... (2 Replies)
Discussion started by: fiori_musicali
2 Replies
5. Shell Programming and Scripting
Hi
can anyone suggest me how to write a file containing values,... say
19
20
21
22
..
40
to an array @array = (19, 20, ... 40)
-- Thanks (27 Replies)
Discussion started by: meghana
27 Replies
6. Shell Programming and Scripting
Hello,
Can somebody please give me a snippet for the below requirement.
I want to assign the values separeted by a comma to be assigned to a dynamic array.
If I give an input (read statement) like abc1,abc2,abc3,abc4,abc5, all these strings abc* should be assigned to an array like below... (2 Replies)
Discussion started by: suneelj
2 Replies
7. Shell Programming and Scripting
I wrote a simply perl that searched a file for a particualr value and if it found it, rite it and the next three lines to a file. Now I have been asked to check those next three lines for a different value and only write those lines if it finds the second value.
I was thinking the best way to... (1 Reply)
Discussion started by: billprice13
1 Replies
8. Shell Programming and Scripting
hi
My script as below
#!/bin/ksh
for i in `seq 1 7`
do
a=$(awk '{print $i}' /home/rama/expenese.txt)
done
for i in `seq 1 7`
do
echo "${a}"
done
content of expense.txt is as below
5032 210179 3110 132813874 53488966 11459221 5300794
I want output as... (6 Replies)
Discussion started by: Ramakrishna V
6 Replies
9. Shell Programming and Scripting
Hi ,
i have file which is having two fields in it (#delimited)
ABC#FILE_01.DAT
DEF#FILE_02.DAT
i want to write first field values to one array example A_01 and second field values to B_02 array
please let me know how to do this ,my final requirement i have send out a mail for each record... (2 Replies)
Discussion started by: kkabc789
2 Replies
10. Shell Programming and Scripting
I know that
@food = %fruit;
Works. But how do I assign %fruit and %veggies to @food ? (2 Replies)
Discussion started by: popeye
2 Replies
LEARN ABOUT DEBIAN
tm::objectable
TM::ObjectAble(3pm) User Contributed Perl Documentation TM::ObjectAble(3pm)
NAME
TM::Synchronizable - Topic Maps, trait for storing objects into backends
SYNOPSIS
my $tm = .... # get a topic map from somewhere
use Class::Trait;
Class::Trait->apply ($tm, "TM::ObjectAble");
my %store; # find yourself a proper store, can be anything HASHish
# append it to the list of stores, or ....
push @{ $tm->storages }, \%store;
# prepend it to the list of stores
unshift @{ $tm->storages }, \%store;
# store it (the proper storage will take it)
$tm->objectify ('tm:some-topic', "whatever object or data");
# get it back
my @objects = $tm->object ('tm:some-topic', 'tm:some-topic2');
# get rid of it
$tm->deobjectify ('tm:some-topic');
DESCRIPTION
This trait implements functionality to store arbitrary data on a per-topic basis.
Conceptually, the storage can be thought as one large hash, as keys being use the internal topic identifiers, as values the object data.
But to allow different topics to store their object data in different places, this interface works with a list of such hashes. Each hash
(native or tied to some implementation) in the list is visited (starting from the start of the list) and can take over the storage. Whether
this is based on the topic id, on some other topic information, or on the MIME type of the data (if it has one), is up to the
implementation to decide.
INTERFACE
Methods
storages
$listref = $tm->storages
This method returns an array reference. You can "unshift" or "push" your storage implementation onto this list.
Example:
my %store1;
push @{ $tm->storages }, \%store1
objectify
$tm->objectify ($tid => $some_data, ...);
This method stores actually the data. It takes a hash, with the topic id as keys and according values and tries to find for each of the
pairs an appropriate storage. If none can be found, it will raise an exception.
NOTE: Yes, this is a stupid name.
deobjectify
$tm->deobjectify ($tid, ...)
This method removes any data stored for the provided topic(s). If no data can be found in the appropriate storage, an exception will be
raised.
object
@objects = $tm->object ($tid, ...)
This method returns any data stored for the provided objects. If no data can be found for a particular topic, then "undef" will be
returned.
SEE ALSO
TM
AUTHOR INFORMATION
Copyright 20(10), Robert Barta <drrho@cpan.org>, All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
http://www.perl.com/perl/misc/Artistic.html
perl v5.10.1 2010-10-27 TM::ObjectAble(3pm)