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

Expand Messages
  • Olivier-Bernard RICHARD
    Hi this is my first post in this ML, I ll shortly introduce myself : my name is Olivier, nick Ozh, from France, so please forgive any weird sentence you ll
    Message 1 of 1 , Jun 26 3:02 AM
      Hi

      this is my first post in this ML, I'll shortly introduce myself :
      my name is Olivier, nick Ozh, from France, so please forgive any weird sentence you'll find in my posts, this is not my mother tongue :)
      I've been using Perl for 5 weeks now and I really love this new language I'm discovering. Particularly those awesome regexp :)
      I use Perl mainly (only ?) for cgi, for my websites.


      I've got a question :

      In a script I retrieve a file's size ($msize), in bytes.
      In order to make it more readable, I want to insert a space each 3 letters (so '123456' becomes '123 456' and '1234' becomes '1 234')

      Here is for now what I did :

      ($msize=reverse $msize)=~s/(\S{3})/$1 /isg;
      $msize=reverse $msize;

      Is there a way to make is prettier ? Is there a way to make reverse regexp (to read the string backwards) ?
      Or do I really need to reverse and reverse once more ?

      Thx

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