The problem is where you have:
The space is throwing off perl. But you DONT NEED to map every city name... if it's not in the hash array, the script will simply capitalize the first letter and take the rest. So:
are also not needed. However this IS needed (just in case):
Otherwise you will get "Union city".
There is an error when i am trying to use the shift command in this way:
($1 = -d, $2 = 123, $3 = -c etc etc)
for $arg in $@
do
case $arg in
"-d") shift; (so that the $2 will become the $arg now)
(and while it loop the 2nd time,)
... (1 Reply)
Hi Folks,
In shell scripting the maximum no. of command line parameters becomes 9(Am i right). If we want to get more than 9 parameters we use the shift command.
Even here there are two possibilities.
1. Without the use of variables - The arguments are lost and the lost no. is equal to the... (6 Replies)
I am running a program where in I have this command
which is giving error the shift: number is not correct.
can you please tell me how shift actually works?
the line which is giving error is-
set $PARAM; shift; shift; shift; shift; shift; shift; shift; shift
Is it related somewhere to... (2 Replies)
hi,
another perl question,
I don't understand the below
while (<FILE>) {
push @last5, $_; #add to the end
shift @last5 if @last5 > 5 ; #take from the beginning
}
can someone please explain to me how does
shift @last5 if @last5 > 5 is taking last 5 lines from... (5 Replies)
Hi,
I wrote one script, in between script needs to use 10th and 11th positional parameters, that time i used "shift". Here i am facing the below find problem,
./DataCount.sh: cannot shift
I tried
1) I have read man pages for shift
2) Before but * and **
3) Simple shift with out giving... (4 Replies)
Hey all, I need some assistance. I'm writing a script to eject tapes from a tape library, but the library is not a queued system and can only eject 15 tapes at a time.
I added paste -d : -s so that it goes through full_tapes and puts each media_id on one line separated by the :.
Now I'm... (2 Replies)
Hi,
Firstly, I did a search for this question both on this site and on the internet and have not been able to find a suitable answer that is not general in nature.
I have always been a Windows user. I use my girl friend's mac every now and then, but I always come back to windows. For a... (1 Reply)
Hello Expert
Can any one please explain what is the use of shift command in general terms:
set -- $(ls -t)
shift
rm -Rf $*
what is the use of shift command over here.
Thanks a lot for your help (2 Replies)
Hello everyone,
I am new to Perl and I am having some issues getting a script to work. I have to create a script that uses an array of 52 cards, "shuffles" the cards (using loops with the pop, shift, and push commands), and prints out the top five. This is not a randomizing of the array just a... (2 Replies)
#!/bin/bash
hostname=$1; shift
for hostname in $1
do
ping $hostname
done
I want to run the above script as hostname.sh yahoo.com google.com cnn.com. I want to shift each hostname to $1. How can do that with above code as currently it's not shifting. (5 Replies)
Discussion started by: scj2012
5 Replies
LEARN ABOUT DEBIAN
jifty::dbi::collection::union
Jifty::DBI::Collection::Union(3pm) User Contributed Perl Documentation Jifty::DBI::Collection::Union(3pm)NAME
Jifty::DBI::Collection::Union - Deal with multiple Jifty::DBI::Collection result sets as one
SYNOPSIS
use Jifty::DBI::Collection::Union;
my $U = new Jifty::DBI::Collection::Union;
$U->add( $tickets1 );
$U->add( $tickets2 );
$U->GotoFirstItem;
while (my $z = $U->Next) {
printf "%5d %30.30s
", $z->Id, $z->Subject;
}
WARNING
This module is still experimental.
DESCRIPTION
Implements a subset of the Jifty::DBI::Collection methods, but enough to do iteration over a bunch of results. Useful for displaying the
results of two unrelated searches (for the same kind of objects) in a single list.
METHODS
new
Create a new Jifty::DBI::Collection::Union object. No arguments.
add COLLECTION
Add Jifty::DBI::Collection object COLLECTION to the Union object.
It must be the same type as the first object added.
first
Return the very first element of the Union (which is the first element of the first Collection). Also reset the current pointer to that
element.
next
Return the next element in the Union.
last
Returns the last item
count
Returns the total number of elements in the union collection
goto_first_item
Starts the recordset counter over from the first item. the next time you call "next", you'll get the first item returned by the database,
as if you'd just started iterating through the result set.
goto_item
Unlike "goto_item" in Jifty::DBI::Collection, Union only supports going to the first item in the collection.
is_last
Returns true if the current row is the last record in the set.
items_array_ref
Return a reference to an array containing all objects found by this search.
Will destroy any positional state.
AUTHOR
Copyright (c) 2004 Robert Spier
All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Jifty::DBI, Jifty::DBI::Collection
perl v5.14.2 2010-12-09 Jifty::DBI::Collection::Union(3pm)