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

  • SEARCH
  • Home
  • 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 7174207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:59:11+00:00 2026-05-28T15:59:11+00:00

What I want to do is to capture the device serial numbers and store

  • 0

What I want to do is to capture the device serial numbers and store them in an array or list. Then I want to install my apk on various android devices that I connect to my system.I am trying to make a perl script that can do this for me.

Something like this:

if($ostype eq 'MSWin32') {

  system("title Android");

    $adbcommand_devices = "adb devices";

    $adbcommand_install = "adb -s xxxxxxxx install HelloWorld.apk";
}

  if(`adb -s xxxxxxxx get-state` =~ m/device/i) {
          system($adbcommand_devices);            
          system($adbcommand_install);

         }
 else {
    print "Device is offline\n";
}

The serial number should come from the currently connected device.

  • 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-28T15:59:12+00:00Added an answer on May 28, 2026 at 3:59 pm

    Here is an example of just the adb devices command using IPC::Run3:

    use strict;
    use warnings qw(all);
    
    use IPC::Run3;
    use Carp qw(croak confess cluck);
    use Data::Dumper;
    
    my $ADB_PATH = '/path/to/adb';  # EDIT THIS
    
    my @devices = get_devices();
    print Dumper(\@devices);
    exit 0;
    
    # subs
    sub get_devices {
        my $adb_out;
        run3 [$ADB_PATH, 'devices'], undef, \$adb_out, undef;
        $? and cluck "Warning: non-zero exit status from adb ($?)";
    
        my @res = $adb_out =~ m/^([[:xdigit:]]+) \s+ device$/xmg;
        return wantarray ? @res : \@res;
    }
    

    For a lot of this, you may be able to use qx/`` as well. E.g., you could replace the run3 with my $adb_out = `$ADB_PATH devices`; (because you didn’t need to pass anything in to it, just out, and also didn’t need to avoid the shell.)

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

Sidebar

Related Questions

I want to capture logs and dump them into a text file, I am
I want to capture a screen shot of Android applications that are running on
I can capture data from serial device via pyserial, at this time I can
I just want to listen a network device, capture packets and write the packets
I want to capture input charcters in text box, convert then according to a
i want's to display image capture using device camera and for that i have
I want to capture the Ctrl + C ( SIGINT ) signal sent from
I want to capture if any changes happened to <textarea> . Like typing any
I want to capture a Flick touch event in Update method. In there, I
I want to capture a single image from my webcam and save it to

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.