Sponsored Content
Full Discussion: Array length in PERL
Top Forums Shell Programming and Scripting Array length in PERL Post 10331 by anent on Monday 12th of November 2001 07:30:30 PM
Old 11-12-2001
Array length in PERL

Hi experts,
How to get the length of an Array in PERL.
for eg., @Var having 5 elements.

regards
Anent
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Variable Sized Array Length Question

I need to implement the following logic and need some expert help from UNIX community. These are the steps in my Shell script. 1. Analyze a file. 2. Extract all the ID's in that file. 3. Use the ID's from #2 to run another filter on the file. I've implemented # 1 and 2 using... (3 Replies)
Discussion started by: katwala
3 Replies

2. Shell Programming and Scripting

MAWK does not support length(array)?

As Brendan O'Conner writes in this blog, mawk is near 8 times faster than gawk, so I am going to give mawk a go, but I got errors when trying to print the length of an array in mawk using length() function, is it not supported in mawk? or there's another way to get the length of an array in mawk? ... (3 Replies)
Discussion started by: kevintse
3 Replies

3. Programming

How to find length of string and pass into char array in C?

Hi All I want to take a Hexadecimal number as input and i want to find lenth of the input and pass it to char s ( char s ). I have a program to convert hexadecial to binary but it is taking limited input but i want to return binary number based on input. How? (1 Reply)
Discussion started by: atharalikhan
1 Replies

4. Programming

Does ansi c support variable-length array?

I successfully compiled code like below. #include<stdio.h> #include<string.h> int main() { int co = 9; char a; strcpy(a, "hahahah"); printf("co=%d\n", co); printf("a=%s\n", a); return 0; } (7 Replies)
Discussion started by: vistastar
7 Replies

5. Shell Programming and Scripting

PERL : Read an array and write to another array with intial string pattern checks

I have an array and two variables as below, I need to check if $datevar is present in $filename. If so, i need to replace $filename with the values in the array. I need the output inside an ARRAY How can this be done. Any help will be appreciated. Thanks in advance. (2 Replies)
Discussion started by: irudayaraj
2 Replies

6. Shell Programming and Scripting

Longest length of string in array

I would be grateful if someone could help me. I am trying to write a .sh script in UNIX. I have the following code; User=john User=james User=ian User=martin for x in ${User} do print ${#x} done This produces the following output; 4 5 3 6 (12 Replies)
Discussion started by: mmab
12 Replies

7. Shell Programming and Scripting

Array Length Reports as Having Length when it is Empty?

Hello All, I have this script that does stuff like "starting, stopping & restarting" a Daemon Process running on my machine... My main question is why in part of my code (which you will see below) does the Array Length (i.e. ${#PIDS} ) return "1" when I know the Array is empty..? Here is... (17 Replies)
Discussion started by: mrm5102
17 Replies

8. Shell Programming and Scripting

How to find length of multidimension array ???

Does anyone know how to find length of multi dimension array of following type A Afor simple array I is to do for (i in A)n++ to find length of array but if it is multi dimension how to find the length ? (2 Replies)
Discussion started by: nex_asp
2 Replies

9. Programming

Integer array length

Hello; When I wrote a function to print out an array, void p_array(int arr) { int i; int size = sizeof(arr) / sizeof(int); // int size = sizeof (arr) / sizeof (arr); for (i = 0; i < size; i++) printf("%d ", arr); printf("\n"); }I could only print out the... (19 Replies)
Discussion started by: yifangt
19 Replies

10. UNIX for Beginners Questions & Answers

Array length: ls and sort

Hi there, I'm listing files and sorting them. When I try to get length of array variable in which these files are stored I get 1 as value. That's weird. files_info="$(find $input_dir -name "*_CHR$i.info" | sort )" printf ${#files_info}"\n" #print length #--loop through... (6 Replies)
Discussion started by: genome
6 Replies
Array(3pm)						User Contributed Perl Documentation						Array(3pm)

NAME
Test::Data::Array -- test functions for array variables SYNOPSIS
use Test::Data qw(Array); DESCRIPTION
Functions array_any_ok( ITEM, ARRAY [, NAME] ) Ok if any element of ARRAY is ITEM. array_none_ok( ITEM, ARRAY [, NAME] ) Ok if no element of ARRAY is ITEM. array_once_ok( ITEM, ARRAY [, NAME] ) Ok if only one element of ARRAY is ITEM. array_multiple_ok( ITEM, ARRAY [, NAME] ) Ok if more than one element of ARRAY is ITEM. array_max_ok( NUMBER, ARRAY [, NAME] ) Ok if all elements of ARRAY are numerically less than or equal to NUMBER. array_min_ok( NUMBER, ARRAY [, NAME] ) Ok if all elements of ARRAY are numerically greater than or equal to NUMBER. array_maxstr_ok( ITEM, ARRAY [, NAME] ) Ok if all elements of ARRAY are asciibetically less than or equal to MAX. array_minstr_ok( ITEM, ARRAY [, NAME] ) Ok if all elements of ARRAY are asciibetically greater than or equal to MAX. array_sum_ok( SUM, ARRAY [, NAME] ) Ok if the numerical sum of ARRAY is SUM. array_empty_ok( ARRAY [, NAME] ) Ok if the array contains no elements. array_length_ok( ARRAY, LENGTH [, NAME] ) Ok if the array contains LENGTH number of elements. array_sortedstr_ascending_ok( ARRAY, [, NAME] ) Ok if each succeeding element is asciibetically greater than or equal to the one before. array_sortedstr_descending_ok( ARRAY, [, NAME] ) Ok if each succeeding element is asciibetically less than or equal to the one before. array_sorted_ascending_ok( ARRAY, [, NAME] ) Ok if each succeeding element is numerically greater than or equal to the one before. array_sorted_descending_ok( ARRAY, [, NAME] ) Ok if each succeeding element is numerically less than or equal to the one before. SEE ALSO
Test::Data, Test::Data::Scalar, Test::Data::Function, Test::Data::Hash, Test::Builder SOURCE AVAILABILITY
This source is in Github: http://github.com/briandfoy/test-data/tree/master AUTHOR
brian d foy, "<bdfoy@cpan.org>" COPYRIGHT AND LICENSE
Copyright (c) 2002-2009 brian d foy. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2009-02-12 Array(3pm)
All times are GMT -4. The time now is 01:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy