If you're trying to pass a reference to SortListItem, it should be with a \
i.e.  &SortListItem(\%data,\%sortonly);

>tony

Jonathan Southwick wrote:

> Cam,
>
> Okay I am getting this to almost work.  However I get an error on this line in the 
>code you gave:
>
>     &SortListItem(/%data,/%sortonly);
>
> ### the code ###
> sub ListView_ColumnClick
>
>     my $col = shift;
>     print "You click on column number $col\n";
>     my %sortonly = &NewList($col,%data);  ## %data is a global variable
>     &SortListItem(/%data,/%sortonly);
> }
>
> If I take out the '/' before the %data and the %sortonly then in the SortListItem 
>subroutine the variable $check is NULL
> and so $check always goes to the sort number part of the routine.  What obvious 
>thing am I doing wrong?
>
> ### the code ###
> sub SortListItem {
>     my ($data,$sortonly,$section) = @_;
>     my $check;
>     my %data = %$data;
>     my %sortonly = %$sortonly;
>
>     $check .= "$_" foreach (values %sortonly); ## Merge all values into 1 string
>
>     if ($check =~ /[a-z]|[A-Z]/g)  { ##--> Compare Num or by Char depending in 
>%sortonly values
>         print "Text Compare!\n";
>         foreach (sort { $sortonly{$a} cmp $sortonly{$b} } keys %sortonly)  {
>              ## Code in here needs to clear the current View
>              ## and then add items all over again.  Just like
>              ## you did when you first created it
>              ## Use the keys that are stored in $_, but get the values
>              ## from the original hash(in this case %data)
>         }
>     } else {
>         print "Number Compare\n";
>         foreach (sort { $sortonly{$b} <=> $sortonly{$a} } keys %sortonly)  {
>              ## Code in here needs to clear the current View
>              ## and then add items all over again.  Just like
>              ## you did when you first created it.
>              ## Use the keys that are stored in $_, but get the values
>              ## from the original hash(in this case %data)
>         }
>     }
> }
>
> Jonathan
> --------------------------------------------------------------
> Jonathan Southwick                              [EMAIL PROTECTED]
> Technical and Network Services
> Allegheny College
> Meadville, PA  16335                             814-332-2755
begin:vcard 
n:George;Anthony
tel;pager:(231) 315-4709
tel;cell:(231) 730-2863
tel;fax:(231) 720-1681
tel;work:(231) 720-1481
x-mozilla-html:TRUE
url:http://www.emsts.com
org:EMS Technical Services
adr:;;965 Fork;Muskegon;MI;49442;USA
version:2.1
email;internet:[EMAIL PROTECTED]
title:Systems Engineer
fn:Anthony C. George
end:vcard

Reply via email to