Click to See Complete Forum and Search --> : n00b CGI question
dominicanpapi82
09-12-2006, 01:16 AM
Sorry for the n00b cgi question. I have a hash, with key bodybgcolor pointing to string "#FF9966". I need to be able to print "FEDCBA" without the number sign. Any way that I do that is fine. Can someone show me how to do that?
Sorry!!
Charles
09-12-2006, 04:16 AM
Getting to "FF9966" is easy, just drop the first character. But how do you get to "FEDCBA"?
dominicanpapi82
09-12-2006, 12:10 PM
Getting to "FF9966" is easy, just drop the first character. But how do you get to "FEDCBA"?
LOL, sorry, I copied and pasted and then edited. I need "FF9966", and in all the tutorials I have been looking at, I can't find the command to delete the first character in a string.
dominicanpapi82
09-12-2006, 12:55 PM
got the answer. $str =~ s/\#//g;
bluestartech
09-20-2006, 11:57 AM
to be more precise, and have some faster perl (which is always good practice)...
$str=~ s/^\#//;
this strips specifically the first character, omitting the 'g' modifier since this is only needed if more than one occurence of # was in the string, which it is not..or at least should not
Diarmuid Ryan
Blue Star Web Design Ireland (http://www.bluestar.ie)