Sponsored Content
Full Discussion: Shift Question (Perl)
Top Forums Shell Programming and Scripting Shift Question (Perl) Post 302274657 by otheus on Thursday 8th of January 2009 04:59:48 AM
Old 01-08-2009
The problem is where you have:
Code:
Union City => "Union City",

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:
Code:
berkeley => 'Berkeley', Vallejo => 'Vallejo'

are also not needed. However this IS needed (just in case):
Code:
"union city" => "Union City"

Otherwise you will get "Union city".
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

shift command

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)
Discussion started by: AkumaTay
1 Replies

2. Shell Programming and Scripting

shift command

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)
Discussion started by: Nisha
6 Replies

3. Shell Programming and Scripting

Regarding the shift command???

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)
Discussion started by: shrao
2 Replies

4. Shell Programming and Scripting

shift and push question in perl

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)
Discussion started by: hankooknara
5 Replies

5. UNIX for Dummies Questions & Answers

shift not working

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)
Discussion started by: Nagapandi
4 Replies

6. Shell Programming and Scripting

script assistance with shift J

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)
Discussion started by: em23
2 Replies

7. UNIX for Dummies Questions & Answers

A Shift into UNIX

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)
Discussion started by: mearex
1 Replies

8. Shell Programming and Scripting

Use of Shift command

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)
Discussion started by: aks_1902
2 Replies

9. Homework & Coursework Questions

Need help with a Perl Script using Pop, Shift, & Push

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)
Discussion started by: Hax0rc1ph3r
2 Replies

10. Shell Programming and Scripting

Shift command help

#!/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
Moose::Meta::TypeConstraint::Union(3)			User Contributed Perl Documentation		     Moose::Meta::TypeConstraint::Union(3)

NAME
Moose::Meta::TypeConstraint::Union - A union of Moose type constraints VERSION
version 2.1202 DESCRIPTION
This metaclass represents a union of type constraints. A union takes multiple type constraints, and is true if any one of its member constraints is true. INHERITANCE
"Moose::Meta::TypeConstraint::Union" is a subclass of Moose::Meta::TypeConstraint. Moose::Meta::TypeConstraint::Union->new(%options) This creates a new class type constraint based on the given %options. It takes the same options as its parent. It also requires an additional option, "type_constraints". This is an array reference containing the Moose::Meta::TypeConstraint objects that are the members of the union type. The "name" option defaults to the names all of these member types sorted and then joined by a pipe (|). The constructor sets the implementation of the constraint so that is simply calls "check" on the newly created object. Finally, the constructor also makes sure that the object's "coercion" attribute is a Moose::Meta::TypeCoercion::Union object. $constraint->type_constraints This returns the array reference of "type_constraints" provided to the constructor. $constraint->parent This returns the nearest common ancestor of all the components of the union. $constraint->check($value) $constraint->validate($value) These two methods simply call the relevant method on each of the member type constraints in the union. If any type accepts the value, the value is valid. With "validate" the error message returned includes all of the error messages returned by the member type constraints. $constraint->equals($type_name_or_object) A type is considered equal if it is also a union type, and the two unions have the same member types. $constraint->find_type_for($value) This returns the first member type constraint for which "check($value)" is true, allowing you to determine which of the Union's member type constraints a given value matches. $constraint->is_a_type_of($type_name_or_object) This returns true if all of the member type constraints return true for the "is_a_type_of" method. $constraint->is_subtype_of This returns true if all of the member type constraints return true for the "is_a_subtype_of" method. $constraint->create_child_type(%options) This returns a new Moose::Meta::TypeConstraint object with the type as its parent. BUGS
See "BUGS" in Moose for details on reporting bugs. AUTHORS
o Stevan Little <stevan.little@iinteractive.com> o Dave Rolsky <autarch@urth.org> o Jesse Luehrs <doy@tozt.net> o Shawn M Moore <code@sartak.org> o XXXX XXX'XX (Yuval Kogman) <nothingmuch@woobling.org> o Karen Etheridge <ether@cpan.org> o Florian Ragwitz <rafl@debian.org> o Hans Dieter Pearcey <hdp@weftsoar.net> o Chris Prather <chris@prather.org> o Matt S Trout <mst@shadowcat.co.uk> COPYRIGHT AND LICENSE
This software is copyright (c) 2006 by Infinity Interactive, Inc.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.18.2 2014-01-19 Moose::Meta::TypeConstraint::Union(3)
All times are GMT -4. The time now is 09:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy