Loading ...
Sorry, an error occurred while loading the content.
 

%ENV hash problems

Expand Messages
  • Jeff Eggen
    Hello group, Does anyone know why the following line of code: my $lastchar = substr( $ENV{PS1} , length( $ENV{PS1} ) - 2); Would properly extract the last 2
    Message 1 of 1 , Nov 1, 2001
      Hello group,

      Does anyone know why the following line of code:

      my $lastchar = substr("$ENV{PS1}", length("$ENV{PS1}") - 2);

      Would properly extract the last 2 characters of my $PS1 environment variable, but not that of another user? I can run this fine, but when another user tries they get the error:

      Use of uninitialized value in string at ./script.pl line 26.

      Well, actually they get it twice.

      I thought the difference might be that the other user has a prompt that ends in "$ ", as opposed to my "> ", but I changed mine and I can still run it okay.

      Any help would be greatly appreciated.

      Jeff Eggen
    Your message has been successfully submitted and would be delivered to recipients shortly.