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

substitution

Expand Messages
  • Shepard, Gregory R
    I had this substation working before, however it is not correctly substituting the time with my new format. Whats going on? $xtime = localtime(); $n= _ ;
    Message 1 of 2 , Aug 1, 2001
    • 0 Attachment
      I had this substation working before, however it is not correctly
      substituting the time with my new format. Whats going on?


      $xtime = localtime();
      $n="_";
      $xtime =~
      s/(\w{3}).(\w{3}).(\d\d?).(\d\d?).(\d\d).*/$n.$1.$n.$2.$n.$3.$n.$4.$n.$5/e;
    • jonathansamuel@yahoo.com
      ... $n.$1.$n.$2.$n.$3.$n.$4.$n.$5/e; It is hard to say, because I do not know what the new format is supposed to be. However, some problems are apparent. When
      Message 2 of 2 , Aug 1, 2001
      • 0 Attachment
        --- In perl-beginner@y..., "Shepard, Gregory R" <gregory.r.shepard@x>
        wrote:
        >
        > I had this substation working before, however it is not correctly
        > substituting the time with my new format. Whats going on?
        >
        >
        > $xtime = localtime();
        > $n="_";
        > $xtime =~
        > s/(\w{3}).(\w{3}).(\d\d?).(\d\d?).(\d\d).*/
        $n.$1.$n.$2.$n.$3.$n.$4.$n.$5/e;

        It is hard to say, because I do not know what the new format is
        supposed to be. However, some problems are apparent. When recalling a
        value that the regex has saved use \1, \2, \3 etc. not $1, $2, $3.
        The latter is for use outside of the regex, not inside it.

        It is not clear what $n is supposed to be doing. \n is a line return.
        Is that what you meant?
      Your message has been successfully submitted and would be delivered to recipients shortly.