Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7040885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:58:18+00:00 2026-05-28T01:58:18+00:00

I am struggling a bit to convert a Perl unpack to Inline::C @array =

  • 0

I am struggling a bit to convert a Perl unpack to Inline::C

@array = unpack("C*", $buf);

This is what I have so far, but I am an Inline::C novice so I am having trouble of what to do next:

STRLEN len;
char* test = SvPVbyte(buf, len);
...
AV* arr = SvRV(?);

Can anyone provide a tip to how to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:58:18+00:00Added an answer on May 28, 2026 at 1:58 am

    The smart thing here is probably to avoid calling unpack, and do what unpack would do, which is simpler.

    STRLEN len;
    char *str = SvPVbyte(buf, len);
    AV *arr = newAV();
    char *ptr;
    
    for (ptr = str; ptr < str + len ; ptr++) {
        SV *char_value = newSViv(*ptr);
        av_push(arr, char_value);
    }
    

    Or, of course, just write the loop and leave out the array if you don’t need it 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a bit of a strange one, but I've been struggling for a
I've managed to convert most of them, but I'm struggling a bit with these
I am not a programmer, I am struggling a bit with this. I have
This should seem to be a fairly straightforward question, but I'm struggling a bit.
I am struggling a bit to figure this one out. I'm working on an
Sorry in advance, I'm struggling a bit with how to explain this... :) Essentially,
The problem is simple, but I'm struggling a bit already. Server server = new
Struggling a bit today. I have the following method that returns a list of
at work I am struggling a bit with the following situation: We have a
Im making a silly 2D game but is struggling a bit with external files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.