Begginer alert!!
I have just started learning perl and have got stuck. I need to initialize a hash array with values from a list. I've been told to do this using a split command, but its just not happening.
Here is the script and output:
SCRIPT:
#!/bin/perl
system("clear");
... (5 Replies)
Dear Friends,
I am doing a sh shell script , But I dont have any idea how to read value from user Keyboard and store them to an array .. Is it possible or not I am not also sure in sh shell script ?
EX:-
#! /bin/sh
read DATA
echo "DATA -" $DATA
echo "DATA -" $DATA
echo "DATA... (7 Replies)
Hi all,
I wrote a script that reads inputs from user and store in array named "input". The number of elements in the array is not fixed - determined only after user exit the while loop that reads the array values :
x=1
echo "Enter first value"
read input
while } != "exit" ]
do
... (1 Reply)
i have a file called file.txt having the following entries.
2321
2311
2313
4213
i wnat to store these values in a list and i want to iterate the list using loop and store it in another list (1 Reply)
Hello!
Im trying to divid the numbers inputed by <STDIN> by 2.
This is what I have:
print "The input array divided by 2 is as follows:\n"; foreach ((@userArray)/2) {print}
But it is not dividing by 2?
Any help is valuable!!
Ben (3 Replies)
Hi,
cut -d: -f1,3 /etc/group >rpt.out
I have a doubt in perl. right i am getting list of group user id into rpt.out file. instead i need to store it as an array in perl script. could you please tell me how can i get list of user into an array in perl script..
thanks in advance. (1 Reply)
Folks,
I have written one script for following condition by referring some of online post in this forum. Please correct it if I'm missing something in it. (OS: AIX 5.3)
List the idle user. (I used whoidle command to list first 15 user and get username, idle time, pid and login time).... (4 Replies)
What I am doing is creating a top menu, which a user will select a choice with a number entry. That number corresponds to a string in an array. I then want to assign that response to another array I've already declared.
For example:
#!/bin/bash
colors=(red blue yellow)
red=(cherry fire)... (2 Replies)
Hello,
I am writing a script that requires the user to enter a string of numbers:
ex: 134 345 865 903
This command only allows for one variable to be entered:
set "var" = $<
and than once I got the array I want to change it to a list with each input on a different line:
... (1 Reply)
hi,
total newbie to shell scripting and wondering if some of you guru's can give me a hand on a problem I'm trying to solve.
The tmplsnr.a file contains
LSNR_51526
db1
db2
LSNR_51527
db3
db4
db5
Summary - depending on which db is set, the script will start the relevant listener... (5 Replies)
Discussion started by: mingy10
5 Replies
LEARN ABOUT PHP
reset
RESET(3) 1 RESET(3)reset - Set the internal pointer of an array to its first elementSYNOPSIS
mixed reset (array &$array)
DESCRIPTION reset(3) rewinds $array's internal pointer to the first element and returns the value of the first array element.
PARAMETERS
o $array
- The input array.
RETURN VALUES
Returns the value of the first array element, or FALSE if the array is empty.
EXAMPLES
Example #1
reset(3) example
<?php
$array = array('step one', 'step two', 'step three', 'step four');
// by default, the pointer is on the first element
echo current($array) . "<br />
"; // "step one"
// skip two steps
next($array);
next($array);
echo current($array) . "<br />
"; // "step three"
// reset pointer, start again on step one
reset($array);
echo current($array) . "<br />
"; // "step one"
?>
SEE ALSO current(3), each(3), end(3), next(3), prev(3).
PHP Documentation Group RESET(3)