#1
  1. No Profile Picture
    d0g1e
    Guest
    Devshed Newbie (0 - 499 posts)
    I've made a script which read directory info and puts it in
    an array. The example content of the array is:

    8407 Bush - Letting The Cables Sleep - Guitar Tab.tab

    (inode number followed by filename)

    I want to create a new array containing two fields;
    an inode number field and a filename field.

    I did this by splitting the array on using " " (a space char)
    as a delimiter. Printing the inode number is easy but how do
    i print the filename in one piece (because it's now split in 9)?

    I tried things like print $arrayname[1-] and $arrayname[1*] but
    they return errors.

    Any ideas?

    Thanks in advance,
    d0g1e
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    16
    $first_element=unshift(@array);
    foreach $element (@array){$rest_array=$rest_array." ".$element}
    $hash{$first_element}=$rest_array;

    Havn't tired that (and am not sure what you really want). But that might work for what you want. %hash would have name=value of inode=the rest.

IMN logo majestic logo threadwatch logo seochat tools logo