The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
perl -write values in a file to @array in perl meghana Shell Programming and Scripting 27 06-07-2009 06:05 PM
problem assigning values to variable finalight Shell Programming and Scripting 2 05-19-2008 11:56 PM
assigning values to a variable trichyselva UNIX for Dummies Questions & Answers 3 12-14-2007 01:55 AM
Problem in assigning values to variables mohanprabu Shell Programming and Scripting 3 08-25-2005 05:44 AM
Assigning values to an array yongho UNIX for Dummies Questions & Answers 4 07-13-2005 09:49 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-14-2008
looza looza is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 23
Cool perl: Assigning array values..

I have to add a variable value to an array, something like this:

......
@my_array_name = $value_of_this_variable;

This doesnt seem to work, any ideas why?

Thanks!
  #2 (permalink)  
Old 07-14-2008
Ikon's Avatar
Ikon Ikon is offline Forum Advisor  
Registered User
  
 

Join Date: Jul 2008
Location: Phoenix, Arizona
Posts: 669
use this:

unshift( @my_array_name, $value_of_this_variable) ;
  #3 (permalink)  
Old 07-14-2008
looza looza is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 23
works!

Thanks!!!
  #4 (permalink)  
Old 07-14-2008
KevinADC KevinADC is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2008
Posts: 731
'unshift' adds to the beginning of an array, 'push' adds to the end of an array.
  #5 (permalink)  
Old 07-15-2008
vikas.nv vikas.nv is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 7
If you want to assign, its like this:

@array = ($value_of_this_variable,$value_of_this_variable_also);

Visit My PERL Blog
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:44 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0