Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Alphnumeric Matching

by mrbbq (Sexton)
on Jan 31, 2012 at 00:18 UTC ( #950851=note: print w/ replies, xml ) Need Help??


in reply to Re: Alphnumeric Matching
in thread Alphnumeric Matching

Hi Thanks for the response, the tape list is already in the arrary @tapes_to_eject. Then i tried to sort them like this:

#my @tapes_to_eject=sort @_ ; my @tapes_to_eject=@_ ; #my @tapes_to_eject=sort { substr($a, 1) <=> substr($b, 1)} @_ +; # Test #print "@_";

Then I run them through the eject command:

`/usr/openv/volmgr/bin/vmchange -res -multi_eject -w -rn $robot_num - +rt tld -rh $robot_host -ml $\@_[0]:$\@_[1]:$\@_[2]:$\@_[3]:$\@_[4]:$\ +@_[5]:$\@_[6]:$\@_[7]:$\@_[8]:$\@_[9]:$\@_[10]:$\@_[11]:$\@_[12]:$\@_ +[13]:$\@_[14]:$\@_[15]:$\@_[16]:$\@_[17]:$\@_[18]:$\@_[19]:$\@_[20]:$ +\@_[21]:$\@_[22]:$\@_[23]:$\@_[24]:$\@_[25]:$\@_[26]:$\@_[27]:$\@_[28 +]:$\@_[29]:$\@_[30]:$\@_[31]:$\@_[32]:$\@_[33]:$\@_[34]:$\@_[35]:$\@_ +[36]:$\@_[37]:$\@_[38]:$\@_[39]:$\@_[40]:$\@_[41]:$\@_[42]:$\@_[43]:$ +\@_[44]:$\@_[45]:$\@_[46]:$\@_[47]:$\@_[48]:$\@_[49]:$\@_[50]:$\@_[51 +]` ;

but the do not come out sorted


Comment on Re^2: Alphnumeric Matching
Select or Download Code
Replies are listed 'Best First'.
Re^3: Alphnumeric Matching
by JavaFan (Canon) on Jan 31, 2012 at 02:56 UTC
    #my @tapes_to_eject=sort { substr($a, 1) <=> substr($b, 1)} @_;
    Well, if you outcomment the sort there's little chance it will sort. And you may want to do a string compare instead of a numeric compare.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://950851]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (12)
As of 2015-07-30 09:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (270 votes), past polls