in reply to Add character in middle

Just substitution regexp (more in manual - perlop): $var =~ s/</<\//;

Replies are listed 'Best First'.
Re^2: Add character in middle
by gem555 (Acolyte) on Aug 12, 2009 at 09:22 UTC
    I used like this,
    #!/usr/bin/perl $var='<date>'; $newvar=$var; $sec = substr($newvar,0,1); $sec = '</'; print $sec,"\n"; print "Old value is $var and new value is $sec";
    It doesnot print like this Old value is <date> and new value is </date>
      Your last assignment to $sec is </. Why would you expect it to contain </date>?