Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Truncating strings... how? 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hey.

I just want to cut off the decimal.

Anybody know a site that just basically lists all the commands, or something?

I hate bugging you guys with simple syntax problems...

Thanks, as always...
-Nexius
 
you can use split to truncate strings.

@array = split("char_to_split_on", $var); adam@aauser.com
 
Pretty vauge question, but i'll give it a shot. So, you have a string: "935.356" which is also a number, no? If this is the case,
Code:
$number = int $number;
or even
Code:
$number = int 935.356;
If it isn't a number, then you'll have to use regular expressions. For lists of functions and for help with regular expressions, your perldocs will have that in it. Read through them sometime.
(the actual perldoc library will be different depending on your system, otherwise i'd include instructions on that.)
"If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
 
NeXidus. Have a look at for some documentation although it should already be installed on your system. Try this command: 'perldoc perlmain'.
Mike
michael.j.lacey@ntlworld.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top