Hi, How to get previous/next element in the array perl
Example
I want to get value of 1 and 2, or, 2 and 3, or 3 and 4...etc and compare to value which one is greater to do that I need to get previous and next element of array ?
Hello everyonel,
I have an array set like so
num=4
read name
arr=name
I go through while loop to assign different values to different array element from 1 to 4. when I try to access the FIRST element of the array I get the last one first. Like if I say ${arr} it will show the last element... (4 Replies)
Probably I am not seeing it or I am not using the "delete" correctly I had the following codes but it does not work for me
#!/bin/perl -w
...
@sysFile1 = (a_b, a_c, a_d);
@sysFile2 = (a_c, a_e, b_f);
foreach $line1 (@sysFile1){
trim(\$line1);
(my $tmp1, my $tmp2) = split/_/,... (6 Replies)
Hello guys,
I have the following question.
Consider the following code in PERL
for($xeAnumber=0; $xeAnumber<@xeAnumber; $xeAnumber++)
{
if(@xeAnumber==@final_file)
{
@final_file=@xeTimeStamp;
}... (3 Replies)
I have a loop and I need to be able to unset the array element that I am currently accessing in it. I was thinking of making a counter that increments with the loop and doing unset $dirs but if I do that I am not sure if the other members of the array would get shifted down in index (meaning that... (2 Replies)
I need to remove an element from the below array variable TABLENAME.
#!/bin/ksh
set -A TABLENAME "mirf roxar keke mirs"
echo "the array is ${TABLENAME}"
If i need to remove say keke and have the final TABLENAME as below, how this could be achieved. Pls throw some light.
echo "Modified... (3 Replies)
Hello,
I want to run one (not multiple) action if an element doesn't exist in array.
for example:
@array = (1..10);
foreach $el (@array)
{
if ($el != 11)
{
print "number not found\n";
}
}
the output of this simple script:
number not found (3 Replies)
I am trying to take all the elements of an array and multiply them by 2, and then copy them to a new array. Here is what I have
i=0
for true in DMGLIST
do
let DMGSIZES2="${DMGSIZES}"*2
let i++
done
unset i
echo ${DMGSIZES2}
It does the calculation correctly for the first element,... (7 Replies)
Hi All,
I am new to perl I am stuck in simple problem I need your help
I want to define a subroutine.
sub check_if_entity_exists(@array_to_be_checked,$entityName)
I have array as
http-listener-1
http-listener-2
http-listener-3
http-listener-4
If i send http-listener-3 my... (1 Reply)
This question is for someone that's more familiar with Array Element.
I need to know if the maximum array element that can be assigned is 1024 and if its so, Is there a workaround solution when the counter exceeded 1024?
param_array="$param_nam"
counter=$counter+1
#to avoid space... (3 Replies)
Discussion started by: cumeh1624
3 Replies
LEARN ABOUT OSF1
insque
insque(3) Library Functions Manual insque(3)NAME
insque, remque - Inserts or removes an element in a queue
LIBRARY
Standard C Library (libc.a, libc.so)
SYNOPSIS
#include <search.h>
void insque(
void *element,
void *pred);
void remque(
void *element);
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
insque(), remque(): XPG4-UNIX
Refer to the standards(5) reference page for more information about industry standards and associated tags.
PARAMETERS
Points to the element in the queue immediately before the element to be inserted. Points to the element to be inserted or deleted.
DESCRIPTION
The insque() and remque() functions manipulate queues built from doubly-linked lists. The queue can be either circular or linear.
An application using these functions must define a structure in which the first two members are pointers to the same type of structure and
any further members are application-specific. The first member of the structure is a forward pointer to the next entry in the queue. The
second member is a backward pointer to the previous entry in the queue. If the queue is linear, it is terminated with null pointers.
The insque() function inserts the element pointed to by element into a queue immediately after the element pointed to by pred.
The remque() function removed the element pointed to by element from a queue.
When using the queue as a linear list, the forward and backward pointers of element can be initialized to null pointers by invoking
insque (&element, NULL);
where element is the initial element of the queue.
When using the queue as a circular list, the application must initialize the forward pointer and the backward pointer of the initial ele-
ment of the queue to the element's own address.
RETURN VALUES
The insque() and remque() functions do not return a value.
RELATED INFORMATION
Standards: standards(5) delim off
insque(3)