Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Answer: How do I get the Nth character of a string?

by vroom (Pope)
on Jan 21, 2000 at 00:56 UTC ( #2263=categorized answer: print w/replies, xml ) Need Help??

Q&A > strings > How do I get the Nth Character of a String? - Answer contributed by vroom

Use substr with a length of one. The character numbering is zero based so the first character in the string is the 0th element.
$str = "123456789"; $first = substr($str, 0, 1); #returns the first character $third = substr($str, 2, 1); #returns the third character

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[usemodperl]: I can find cpan mirrors on http but not with plain files, only tar.gz, does something like meta exist on http?
[marto]: run your own mirror minicpan
[marto]: or just fatpack/package your apps
[Corion]: usemodperl: No. I think your approach to "downloading modules" is horribly misguided. I recommend you use the standard tools, and/or move your own tools to standard interfaces. Or maybe just set up your own plaintext mirror if that's what you need.
[Corion]: usemodperl: If your "audience" runs old, locked-down computers that can connect to the outside world, they shouldn't install random stuff from CPAN. Especially, as many modules on CPAN don't work with 5.005_004 anymore.
[usemodperl]: downloading modules is wrong? oh dear...
[usemodperl]: just answer my question without judging me or my technique, if that's possible around here anymore, sheesh
[Corion]: usemodperl: You should be well aware of the ways to make your approach still work, even if it is to set up your own proxy that strips HTTPS. It shouldn't be hard for somebody with your acumen.
[Corion]: Unless you just want to vent your frustration about how others don't provide for your whims. That's sometimes necessary. There, there.
[usemodperl]: so to answer my question, no http at cpan, and all rationalized too, thanks

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (11)
As of 2018-06-24 16:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (126 votes). Check out past polls.

    Notices?